-
Notifications
You must be signed in to change notification settings - Fork 0
/
nixieprint.py
75 lines (65 loc) · 1.29 KB
/
nixieprint.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
import random
import sys
import argparse
nixie_tube_digits = {
0: """ _
| |
|_|""",
1: """
|
|""",
2: """ _
_|
|_ """,
3: """ _
_|
_|""",
4: """
|_|
|""",
5: """ _
|_
_|""",
6: """ _
|_
|_|""",
7: """ _
|
|""",
8: """ _
|_|
|_|""",
9: """ _
|_|
_|""",
"DOT": """
."""
}
parser = argparse.ArgumentParser(description='Process some input.')
parser.add_argument('-w', '--hacktogate', action='store_true', help='worldline')
args = parser.parse_args()
if args.hacktogate:
print("\033[38;2;255;100;0mWORLDLINE:\033[0m")
prompt = str(format(random.uniform(0, 1.999999), '.6f'))
else:
if len(sys.argv) > 1:
prompt = sys.argv[1]
else:
try:
prompt = input("Enter input (only decimals and ints allowed): ")
except KeyboardInterrupt:
print("\n")
quit()
# validate prompt
for i in prompt:
if i not in ".0123456789":
print(f"Invalid char: '{i}'")
quit()
for i in range(len(nixie_tube_digits[1].splitlines())):
l = ""
for x in list(prompt):
if x == ".":
l += nixie_tube_digits["DOT"].splitlines()[i]
else:
l += nixie_tube_digits[int(x)].splitlines()[i]
print(f"\033[38;2;255;100;0m{l}\033[0m")