-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathneedymodules.py
103 lines (87 loc) · 2.75 KB
/
needymodules.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
# Needy Modules Sub-Expert
# Created by Reese Ford 10/17/2022
# https://www.github.com/RicePerson/KTANExpert
from os import system
system("title " + "NeedyModule Sub-Expert")
# Knobs
def knobs():
leds = "EMPTY"
leds = str(input("What is the led pattern?: "))
if leds == "...": #Exit Command
print("Exit Command Detected. Exitting")
leds = "EMPTY"
return
ledsList = [x for x in leds]
for l in ledsList: #Checking for non-binaries
if l == "1" or l == "0":
pass
else:
print("Error. Non-binary character detected. Resetting")
return
if len(ledsList) != 12: #Checking Length
print("Error. Incorrect number of leds detected. Resetting")
return
side = "EMPTY"
side = str(input("What side is 'up' on? (north,east,south,west): "))
if side == "...": #Exit Command
print("Exit Command Detected. Exitting")
side = "EMPTY"
return
match side:
case("north"): side = 0
case("east"): side = 1
case("south"): side = 2
case("west"): side = 3
case other:
print("Error. Incorrect Direction Detected. Resetting")
return
match leds:
case("001011111101"):
position = 0
case("101010011011"):
position = 0
case("011001111101"):
position = 2
case("101010010001"):
position = 2
case("000010100111"):
position = 3
case("000010000110"):
position = 3
case("101111111010"):
position = 1
case("101100111010"):
position = 1
case other:
print("Error. Incorrect leds detected. Resetting")
return
position = (position + side)%4
print(" ")
match position:
case 0:
print("Turn the knob to the north position")
return
case 1:
print("Turn the knob to the east position")
return
case 2:
print("Turn the knob to the south position")
return
case 3:
print("Turn the knob to the west position")
return
case other:
print("Something went wrong. Resetting")
return
#Starting Text
print("Needy Modules Sub-Expert")
print("Created by Reese Ford")
print(" ")
print("Needy Modules are pretty simple. There are only 3 possible ones.")
print("There is Venting Gas, Capacitor Discharge, and Knobs")
print("For Venting Gas, just follow the prompts on the screen with the goal to vent gas")
print("For Cap Discharge, pull down the lever to discharge the capacitor before it explodes")
print("For Knobs, follow the instructions below:")
while True:
print(" ")
knobs()