-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
60 lines (48 loc) · 1.43 KB
/
main.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
from echo import echo, MORSE, ALPHABET, full_expand
# Silly alfa lima foxtrot alfa.
S = 'The quick brown fox jumps over the lazy dogs'
print(echo(S))
print()
print(echo(echo(S)))
print()
print(echo(echo('Hi')))
print()
print()
# Prosigns
EQUIVALENT_PROSIGNS = []
for a1 in range(26):
for a2 in range(26):
for b1 in range(26):
for b2 in range(26):
if a1 == b1 and a2 == b2:
continue
prosign_1 = MORSE[a1] + MORSE[a2]
prosign_2 = MORSE[b1] + MORSE[b2]
if prosign_1 == prosign_2:
text1 = ALPHABET[a1] + ALPHABET[a2]
text2 = ALPHABET[b1] + ALPHABET[b2]
EQUIVALENT_PROSIGNS.append(text1 + " = " + text2)
print(EQUIVALENT_PROSIGNS)
print()
print(len(EQUIVALENT_PROSIGNS), "equivalent prosigns in list above")
N_TWO_LETTER = len(ALPHABET) ** 2
print(N_TWO_LETTER, "two-letter prosigns")
N_EDGES = N_TWO_LETTER * (N_TWO_LETTER - 1) / 2
print(N_EDGES, "edges in complete graph")
print(len(EQUIVALENT_PROSIGNS) / 2, "equiv. prosigns, excluding dups")
PROPORTION = len(EQUIVALENT_PROSIGNS) / 2 / N_EDGES
print(PROPORTION, "proportion of edges are equivalent")
print()
print()
# Expand unspaced morse to all text possibilities
SOS = ["...---..."]
UNKNOWN = ['.-..-...-.']
print(SOS)
s = full_expand(SOS)
print(s)
print(len(s))
print()
print(UNKNOWN)
s = full_expand(UNKNOWN)
print(s)
print(len(s))