Skip to content

Commit 5ea2826

Browse files
committed
start commandmain
1 parent 461f7a1 commit 5ea2826

File tree

5 files changed

+65
-27
lines changed

5 files changed

+65
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Perhaps I'll discover that I can actually program. Or maybe I can't. I don't kno
66

77
The `standalone_modules` folder is for modules that stand on their own. They do not require any sort of edgework,
88
it's just calculations based on given values. All of these files are desigend to run on their own - none of them need
9-
to be supplied anything. Just run them and they will solve the module for you.
9+
to be supplied anything. Just run them and they will solve the module for you. Alternatively, the cmd_main.py file should also be able to run them.
1010

1111
The `modules` folder all require a Bomb object to be passed to them, meaning they require edgework.
1212
They shouldn't be excruciating to solve.

cmd_main.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from bomb import Bomb
2+
import modules
3+
import standalone_modules.adjacentletters
4+
5+
solve_methods = {
6+
"adjacentletters": standalone_modules.adjacentletters.solve,
7+
"adventuregame": None,
8+
"alphabet": None,
9+
"astrology": None,
10+
"backgrounds": None,
11+
"bigcircle": None,
12+
"binaryleds": None,
13+
"bitwise": None,
14+
"blindalley": None,
15+
"booleanvenndiagram": None,
16+
"bulb": None,
17+
"button": modules.button.solve,
18+
"caesarcipher": modules.caesarcipher.solve,
19+
"cheapcheckout": None,
20+
"complicatedwires": modules.complicatedwires.solve,
21+
"combinationlock": None,
22+
"creation": None,
23+
"cryptography": None,
24+
"emojimath": None,
25+
"flags": None,
26+
27+
}
28+
29+
params = {
30+
31+
}
32+
33+
# A version of this project's driver file, but available for use
34+
# from the command line.

main.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,22 @@
1010
# -------------------#
1111

1212
current_bomb = Bomb(
13-
'ABCDE2', # serial number
14-
lit_indicators=['NSA'],
15-
unlit_indicators=[],
16-
batteries=2,
17-
holders=1,
13+
'EJ4PA3', # serial number
14+
lit_indicators=['CLR'],
15+
unlit_indicators=['IND'],
16+
batteries=5,
17+
holders=3,
1818

1919
ports=[
20-
[],
21-
['RJ', 'RCA']
20+
2221
],
2322

24-
module_count=15,
25-
time=20
23+
module_count=5,
24+
time=60
2625
)
2726

2827

2928
# -------------------#
3029
# SOLVING MODULES #
3130
# -------------------#
32-
modules.caesarcipher.solve(current_bomb, 'ASDFE')
31+
modules.button.solve(current_bomb, 'red', 'hold')

modules/button/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from termcolor import cprint
33

44

5-
def solve(bomb: Bomb, word: str, color: str):
5+
def solve(bomb: Bomb, color: str, word: str):
66
cprint('The Button', 'yellow', attrs=['reverse'])
77
# Preprocessing
88
word = word.upper()

standalone_modules/adjacentletters.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@
3232
}
3333

3434

35+
def solve():
36+
cprint('Adjacent Letters', 'yellow', attrs=['reverse'])
37+
cprint('Input your buttons in this format:', 'green')
38+
print('''ABCD
39+
EFGH
40+
IJKL
41+
''')
42+
43+
letters = [get_input_row(), get_input_row(), get_input_row()]
44+
45+
print('Your input:')
46+
print(letters)
47+
print()
48+
print('Buttons to press:')
49+
50+
calc_letters(letters)
51+
52+
3553
def calc_letters(letterlist):
3654
if None in letterlist:
3755
print('Invalid arguments. Please try again.')
@@ -66,18 +84,5 @@ def get_input_row():
6684
return list(row.upper())
6785

6886

69-
cprint('Adjacent Letters', 'yellow', attrs=['reverse'])
70-
cprint('Input your buttons in this format:', 'green')
71-
print('''ABCD
72-
EFGH
73-
IJKL
74-
''')
75-
76-
letters = [get_input_row(), get_input_row(), get_input_row()]
77-
78-
print('Your input:')
79-
print(letters)
80-
print()
81-
print('Buttons to press:')
82-
83-
calc_letters(letters)
87+
if __name__ == '__main__':
88+
solve()

0 commit comments

Comments
 (0)