-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseCounter.py
More file actions
62 lines (56 loc) · 1.91 KB
/
Copy pathBaseCounter.py
File metadata and controls
62 lines (56 loc) · 1.91 KB
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
import typing, time
def Main():
print("Charset/Base, type all the characters you'll use, type 2 characters to exit:")
final_chars = []
stuff = True
while stuff is True:
tmp = input()
if tmp != "\\n" and len(tmp) >= 2:
stuff = False
final_chars = list(dict.fromkeys(final_chars))
if "\\n" in final_chars:
final_chars[final_chars.index("\\n")] = "\n"
print(final_chars)
break
final_chars.append(tmp)
lastone = input("when adding numbers, set to 2nd value (ej: 0, 1, 10, 11 instead of 0, 1, 00, 01)? True/False (default: True) ")
delays = input("delay (default: 0.1): ")
last1 = True
dlay = 0.1
if lastone == ("True" or "False"):
last1 = bool(lastone)
if delays is not None and delays != " " and delays != "":
dlay = float(delays)
Base(lastisone=last1, delay=dlay, base=final_chars)
def Base(lastisone: typing.Optional = True, delay: typing.Optional = 0.1, base: typing.Optional = ["0", "1"]):
def Convert(target):
list1 = []
list1[:0] = target
return list1
global string
string = Convert(base[0])
cur = 0
print(base[0])
time.sleep(delay)
while (True):
cur += 1
global shouldskip
shouldskip = False
stringindex = len(string) - 1
while string[stringindex] == base[-1]:
string[stringindex] = base[0]
if stringindex != 0:
stringindex -= 1
else:
shouldskip = True
string.insert(0, base[int(lastisone)])
stringindex = int(lastisone)
if shouldskip is False:
string[stringindex] = base[base.index(string[stringindex]) + 1]
print("".join(string))
if cur == 2141833:
print("Loss")
break
time.sleep(delay)
if __name__ == '__main__':
Main()