-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdie_variance_8too.py
209 lines (190 loc) · 19 KB
/
die_variance_8too.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
import random
import numpy as np
import matplotlib.pyplot as plt
from collections import Counter
def bin2dec(binary):
return int(binary, 2)
def dec2bin(decimal):
return bin(decimal)[2:].zfill(90)
def generate_custom_binary():
groups = [
"1010100100", "1100100001", "0101111001", "1111101000", "0000110001", "0010001100", "1000000101", "0101110111", "0101100000", #1-9
"0011111000", "0011000000", "1111101110", "0001001011", "1110011011", "0101101011", "0001010100", "1101101001", "0001110111", # 18
"0000011110", "1011000101", "1000000011", "1001010110", "1010011110", "0111010001", "1000011010", "0111100111", "0011101110", # 27
"1011110011", "0110110011", "0011100101", "0101101010", "0001010010", "0010100001", "0000011010", "1100000000", "0110001100", # 36
"0110111010", "1011011010", "1101110001", "0111110010", "0100010010", "1011011111", "0011111111", "1101011110", "0100011010", # 45
"1001011111", "0000110011", "0100111011", "1011111010", "1011110000", "1000000111", "0100111101", "0100001101", "0111011111", # 54
"0010100110", "0100000010", "1100011000", "0111011001", "1101000101", "1000100110", "0011110111", "0000001101", "0010000000", # 63
"1000000110", "0111101111", "1111000100", "0000001100", "0110001101", "1010000110", "0001000110", "0100000000", "0101011111", # 72
"0110101011", "0011100110", "0010001000", "1010101110", "0001100110", "0101011000", "0010110001", "0111110110", "1001111111", # 81
"1000111101", "0011000101", "1111001001", "0011000010", "0011110110", "0111100011", "1111010100", "1100010110", "1000010001", # 90
"1110110001", "0010000011", "1011110110", "1001110011", "1101011000", "1011011100", "0100100110", "0100011111", "1110010001", # 99
"0011111011", "0111100001", "0000010010", "1010101011", "0101111000", "1101101010", "0101010010", "0010010001", "0011111010", # 108
"1111111100", "0100110010", "0101011010", "1111100011", "0111111010", "1011010100", "1111110110", "0100010110", "0100000100", # 117
"1001111100", "0111001001", "1111010010", "0110001110", "1111111011", "1101000010", "1011100000", "0001101110", "1011110010", # 126
"1001111011", "1101010000", "0001110110", "1101010101", "0001101100", "0011010011", "1110100101", "0001001100", "0110010000", # 135
"1101110010", "0000110000", "0111111011", "1010011001", "1101101101", "0110010110", "0000000010", "1000010101", "0010111101", # 144
"0011001101", "0010101011", "1101000110", "1011010101", "1010000101", "0010111010", "1110001100", "0100110101", "0100001100", # 153
"0100011110", "0101100001", "0100100001", "1100110011", "1000000000", "0100001111", "1110110101", "0011001100", "0110000000", # 162
"0001010110", "0001001110", "1010100110", "0101100101", "1100010001", "1001001000", "0000000000", "0001000000", "1000110101", # 171
"1100011010", "0110100101", "1001011110", "0111111100", "0000000111", "0100010101", "0010011111", "0000100001", "0100010001", # 180
"0000010110", "0010101001", "1001100110", "1101011111", "0110100000", "0101010100", "0110011001", "0010000101", "0001110010", # 189
"0110101010", "0100110000", "1100111010", "1010001111", "1111011010", "1110111111", "1101100111", "0110110000", "0110100011", # 198
"0110011111", "0110111001", "0000010001", "0000000001", "0000000100", "0110111000", "0110011011", "1111110000", "1100101000", # 207
"1001010011", "1110111011", "0101110110", "1100011100", "1000000100", "1100011101", "1110000111", "1001001010", "1001001111", # 216
"1111100001", "1110011111", "1111101011", "1100101101", "0011110101", "1111011101", "1110100111", "1011101011", "1110000101", # 225
"1000001010", "1111010000", "0000100010", "0011100001", "1110011110", "0000011011", "0001101000", "1010110011", "1111010101", # 234
"0011101010", "0001000101", "0010011000", "1111011111", "1111111000", "1010010010", "0100101101", "1111001110", "1110111000", # 243
"0000100011", "0001100000", "0100001110", "0011101011", "0000101111", "0100110001", "0011100011", "0100101111", "0001011101", # 252
"0111010100", "1101010111", "1001000011", "0110110010", "1001000001", "1110110100", "1001000101", "0001010101", "1100001010", # 261
"0010000010", "0111100100", "0011001000", "0011011000", "1100111110", "0101011001", "1101001010", "0101011011", "0100100010", # 270
"0011011010", "1111111110", "0100100100", "0001011010", "1011111100", "1000100010", "1111111111", "0111011011", "0100110011", # 279
"0101000001", "1011001100", "0011010111", "1100000100", "1011100011", "0000100000", "1100100111", "1011000011", "1011001000", # 288
"0010101000", "1001011010", "0000010000", "1110101110", "1110011001", "0010100100", "1011101110", "1011111000", "0010100000", # 297
"1000101110", "1001011000", "0011100010", "1110111110", "0111101100", "1010011000", "0100001001", "1011011001", "1001001100", # 306
"1011001111", "1000010100", "0111101110", "0111110100", "0011100000", "0001101101", "0010011010", "0010110011", "0110111100", # 315
"1110111001", "1011100100", "1101111101", "0100100000", "1001011100", "1011111011", "1001111001", "0011011110", "1110001011", # 324
"0010001001", "1000110110", "1000011101", "0001001111", "0110000011", "0101101110", "0101100010", "0111110000", "0110101000", # 333
"0011011001", "1000110000", "1000001001", "0001010001", "0110001111", "0011111110", "0011001110", "0010011001", "1010101010", # 342
"1101011100", "0111001101", "0010001111", "0010010000", "0010100010", "1101101111", "1000001100", "1100111011", "1001111110", # 351
"1011010111", "0001111011", "1110011100", "1101010001", "1000010010", "1011111111", "1000010011", "1010101101", "0011010001", # 360
"0100111001", "0111101101", "1001000110", "1011100101", "0101110101", "0110101100", "1111111101", "0001010111", "1010010111", # 369
"1111011100", "0011000111", "0111101011", "0100000111", "0010010011", "0000111111", "1010100111", "0111001110", "0111000111", # 378
"0111000000", "1100001101", "0010111111", "1101001001", "0001011001", "1111110011", "0111010101", "1111000000", "0010100101", # 387
"0110111111", "1101111111", "0001000001", "0001001000", "0110101001", "0000010101", "0010111110", "0010101100", "0000101101", # 396
"0111011110", "0011001001", "0001101111", "1011001101", "1101100100", "1010001010", "0111111110", "0011101101", "0000001110", # 405
"0000001001", "0011110000", "0101110010", "0011100100", "0100010000", "0101011110", "1111100111", "1111111010", "0100101000", # 414
"1011010010", "0100100101", "0110001001", "0101001111", "1011110101", "1100001111", "0000101001", "1100100011", "0110000110", # 423
"1001110101", "0101101111", "1111110111", "1110001111", "0100000101", "1011010000", "0001101010", "0100100111", "0010101010", # 432
"0000001111", "0111110011", "1101010011", "1101110101", "1101000000", "0000010011", "1000110100", "0111101001", "0101111111", # 441
"0001101001", "1101101000", "1111001011", "0101101001", "0010010110", "1000001011", "0110011010", "1011011011", "1010111010", # 450
"1100101100", "1111011011", "1111101111", "1010011010", "0100000011", "0001100101", "0111000011", "0101111011", "1111000111", # 459
"1010100000", "0101111010", "1010000001", "0001011110", "1111100010", "1011101000", "0011011011", "1000111111", "1100001011", # 468
"1111000011", "0111100101", "1000110011", "0101000000", "0011100111", "1011101111", "0110101111", "0111111111", "1110101111", # 477
"0101111101", "1001110111", "1100110110", "0111011100", "0000111100", "1100010000", "1011111001", "1101110011", "0000110100", # 486
"0111000100", "1000011011", "1010010001", "0000111001", "0010001010", "1100011011", "1010110100", "1010011011", "1001000010", # 495
"1000011111", "1101001111", "0000010100", "0000001000", "0001110101", "1101111110", "1001101000", "1101011010", "0011011101", # 504
"1100101011", "1010110111", "1101101110", "1111011110", "1001000000", "1000000010", "0001000010", "0100101110", "1010111001", # 513
"1100100000", "0101111110", "0110110100", "0001011100", "1001100011", "0000000011", "1001100101", "0101101000", "1001101001", # 522
"0111000010", "0000111011", "1001101111", "0111101010", "1000101000", "0001000111", "1100000001", "1100101111", "0010011110", # 531
"0000011101", "0001110100", "0000110010", "1100010010", "1101001101", "0011010000", "1100111111", "1100110010", "1110010111", # 540
"0110000010", "0010011100", "0100000110", "1111011000", "1010001100", "0000101100", "1100100110", "1010011100", "1000010000", # 549
"0100101010", "0110010111", "1110100110", "0101010111", "0111110111", "0000000110", "0111110001", "0110010101", "0000001011", # 558
"0011001011", "0110011101", "1101011101", "0101011101", "0100110111", "0000100101", "0100011100", "1010010100", "1101001100", # 567
"1100111100", "1100111101", "0000000101", "1100111000", "1000100111", "0110000001", "1101001110", "1001100100", "1011001010", # 576
"1010000010", "0011110011", "0011000100", "1110011010", "0101101101", "0110000101", "0011000011", "1100001110", "1011100010", # 585
"1011001110", "1010001110", "0000011000", "0100110100", "1010010011", "1110010011", "0001011111", "1001101100", "0110100001", # 594
"1110110111", "1001000111", "1110101000", "1001000100", "1011000111", "1111101100", "1011000010", "0101110000", "0101111100", # 603
"1011100001", "0110110110", "1111000110", "1100110100", "1111001111", "1111110001", "1011111110", "0001000100", "0011001010", # 612
"0011101100", "1100000011", "1001110001", "1010110101", "1111100110", "1001001001", "1110100010", "1011101010", "1011111101", # 621
"1100000010", "1001011001", "0000111000", "0111111000", "1010011101", "1010010000", "1111000101", "1001100010", "0000101110", # 630
"1000111011", "0000111010", "1010000000", "1011000000", "0001111101", "1001011101", "0011111001", "1111010011", "1000000001", # 639
"0010100011", "1011010001", "1001111000", "0011010110", "1101000100", "0100110110", "1100101010", "0110111101", "0100000001", # 648
"1111110101", "0000100100", "1000100000", "1111111001", "1111100100", "1110001101", "1000101011", "0011001111", "0011000001", # 657
"1011001011", "1010111000", "1111011001", "1111001101", "1101111011", "0010000001", "1010001000", "1100110001", "0101100111", # 666
"0010001101", "1110010110", "0010010101", "1011001001", "1110000000", "1111100101", "0111111001", "0111001000", "0000010111", # 675
"1111010001", "0010010111", "0011010010", "1010100011", "0101000010", "0110111110", "0101000011", "0001100010", "1010111100", # 684
"0000111110", "0111010111", "0011110001", "1000001111", "0110100100", "0101110001", "1100101001", "1001101011", "1010011111", # 693
"1000100100", "1110111100", "1010111011", "1100110101", "0111001011", "1010010101", "1001010001", "0000011001", "1100010011", # 702
"1010100101", "0110001010", "1111010110", "1001101010", "0101000100", "0110001011", "0101001011", "0100111110", "0110101110", # 711
"0101000101", "1111101001", "1001011011", "1101011011", "0100111000", "1110000110", "0101110100", "1011110100", "0111010110", # 720
"1000101001", "1001101110", "0010111011", "1101101011", "1011000001", "1010110001", "0000110111", "1110010100", "0111011010", # 729
"0000101010", "0001110000", "0101010001", "0010110110", "1111101101", "0011011111", "0000110101", "1011011000", "0101010110", # 738
"0011111101", "1010001101", "0110011100", "0010101111", "0001111000", "1010101100", "1001010101", "1100101110", "1101000111", # 747
"0010000111", "1111101010", "0001001001", "1010110110", "0111011101", "1000110001", "0011111100", "1000001000", "1010010110", # 756
"0010110000", "0001100011", "1011110111", "1111010111", "0100011000", "1010111111", "0100111100", "0011101111", "1110011101", # 765
"0100001010", "1110101101", "1000111110", "1011000110", "0000100111", "1000001110", "0100010100", "1110101011", "0111011000", # 774
"1110001000", "1000100001", "1110101001", "1000011000", "1100001100", "0001101011", "1011010011", "1011101100", "0001100100", # 783
"1101010010", "1001110110", "0011110010", "1100010100", "0110000100", "1001111010", "1010101001", "1100010111", "1100011110", # 792
"1010000100", "1101010100", "0111000110", "1111001100", "0010010010", "0010110010", "1101011001", "0110000111", "0100001011", # 801
"1101000001", "0100111010", "1011011110", "0111001100", "1010111110", "0000001010", "0111010010", "1101110000", "0100011101", # 810
"1101100001", "0011000110", "1001001110", "0001111100", "1100110111", "1100000111", "1000111100", "1110000011", "1110000001", # 819
"0010101110", "1001010010", "0010000100", "1000011001", "1001100000", "1011010110", "1001100001", "1010100001", "0000011100", # 828
"1100100010", "0001111111", "0101100110", "1000110010", "0010110100", "0011101000", "0110100110", "1000101101", "0011010100", # 837
"1001110100", "0100100011", "0110111011", "1101110100", "0100101011", "0000110110", "0111100000", "1001101101", "0101101100", # 846
"1011000100", "1110011000", "1101110110", "1001001101", "0110110101", "0100101001", "1011011101", "0111110101", "0111000001", # 855
"1010000111", "0111101000", "0001010000", "0111100110", "0100001000", "0100011001", "1011110001", "1110010000", "0000101000", # 864
"0110010011", "0100010011", "0111001010", "0111010011", "0111111101", "0101001010", "1101100101", "0010011101", "1110010010", # 873
"1100110000", "0110010010", "1101110111", "1101010110", "1010111101", "0101011100", "0000111101", "0001110001", "1110001001", # 882
"1110100100", "1110101010", "1010110000", "1110100011", "0110110001", "0001100001", "1101001000", "0100011011", "0110100111", # 891
"1100000101", "0110011000", "1101100110", "1110111101", "1001010000", "0110101101", "1101111001", "0110001000", "0101001101", # 900
"0001111110", "0001001101", "0010000110", "1110111010", "1011101101", "0001100111", "1100001000", "0010001110", "1110010101", # 909
"0110010100", "1100000110", "0100111111", "1000001101", "0010110111", "0111010000", "1000101111", "0001001010", "0101100011", # 918
"1110101100", "1001010111", "0010111000", "0101010000", "1001100111", "0010011011", "0010010100", "0010001011", "0001111010", # 927
"0001111001", "0001110011", "0001011011", "0001011000", "0001010011", "0001000011", "0000101011", "0000100110", "0000011111", # 936
"0100010111", "0011110100", "0011101001", "0011011100", "0011010101", "0010111100", "0010111001", "0010110101", "0010101101", # 945
"0010100111", "1100111001", "1110110110", "1011100111", "0100101100", "1000111000", "1101000011", "1111100000", "1000110111", # 954
"0101001100", "0101010101", "1101111100", "1010001001", "1111001010", "1110110000", "1101100011", "1000101010", "1110001010", # 963
"1100001001", "1101101100", "0101010011", "1101100000", "0101001110", "1000011100", "1110110010", "1000111010", "1001010100", # 972
"1011101001", "0101100100", "1010101111", "1000100011", "0110110111", "0101000111", "1110000100", "0101001000", "1100011001", # 981
"0110100010", "1100011111", "1100010101", "1000101100", "0110011110", "1110100001", "1000111001", "1010100010", "1110000010", # 990
"1111000001", "1001110000", "1100100100", "0101110011", "1111110010", "0110010001", "1101111000", "0101001001", "1101100010", # 999
"0111100010", "1000100101", "1010000011", "1111001000", "1010001011", "1110100000", "1000011110", "1111000010", "1011100110", #1008
"0111001111", "1100100101", "1110110011", "1001111101", "1010101000", "1001110010", "1010110010", "0101000110", "0111000101", #1017
"1110001110", "1000010110", "1101001011", "1000010111", "1111110100", "1101111010", "1001001011"
]
selected_numbers = []
binary_patterns = [] # To store selected groups
for segment_index in range(9): # For each 10-digit segment to make 90 digits total
selected_group = random.choice(groups)
binary_patterns.append(selected_group)
base_number = random.randint(0, 9)
one_counter = base_number
first_one_found = False
# For positions in this 10-digit segment
for position in range(10):
bit = selected_group[position % len(selected_group)]
if bit == '1':
if not first_one_found:
selected_numbers.append(str(one_counter))
first_one_found = True
else:
# Randomly increment or decrement by 1
step = random.choice([-9, 9, 1, -1])
one_counter = (one_counter + step) % 10
selected_numbers.append(str(one_counter))
else:
random_digit = random.randint(0, 9)
selected_numbers.append(str(random_digit))
return ''.join(selected_numbers[:90]), binary_patterns
def main():
num_binaries = 30 # Generate binaries from Binary0 to Binary29
binaries = []
patterns_list = []
random_binary_index = random.randint(0, num_binaries - 1)
random_digit_index = random.randint(0, 89)
# Generate and print binaries
for i in range(num_binaries):
binary, patterns = generate_custom_binary()
binaries.append(binary)
patterns_list.append(patterns)
if i == random_binary_index:
marked_binary = binary[:random_digit_index] + '\033[91m' + binary[random_digit_index] + '\033[0m' + binary[random_digit_index + 1:]
print(f"Binary{i}: {marked_binary}")
else:
print(f"Binary{i}: {binary}")
# Combine all binaries into one string
combined_binary = ''.join(binaries)
# Convert combined binary string to a list of integers for analysis
digits = [int(d) for d in combined_binary]
# Count the frequency of each digit
counts = Counter(digits)
print(f"Frequencies: {counts}")
# Calculate statistical measures
mean_value = np.mean(digits)
median_value = np.median(digits)
std_deviation = np.std(digits)
print(f"\nStatistical Measures:")
print(f"Mean: {mean_value:.60f}")
print(f"Median: {median_value}")
print(f"Standard Deviation: {std_deviation:.60f}")
# Plotting the digit frequencies
#plt.figure(figsize=(10, 6))
#plt.bar(counts.keys(), counts.values())
#plt.xlabel('Digit')
#plt.ylabel('Frequency')
#plt.title('Digit Frequencies in Combined Binaries')
#plt.xticks(range(10)) # Digits from 0 to 9
#plt.show()
if __name__ == "__main__":
main()