Skip to content
This repository was archived by the owner on Feb 22, 2020. It is now read-only.

Commit 09976dd

Browse files
committed
Fixed data access
1 parent d647951 commit 09976dd

File tree

1 file changed

+29
-43
lines changed

1 file changed

+29
-43
lines changed

amphibian-alchemists/app/classes/game/gamescreen.py

Lines changed: 29 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -61,67 +61,53 @@ def setup_new_game_settings():
6161
if currrent_game_id is None:
6262
store.put("latest_game_id", id=0)
6363
else:
64-
store.put("latest_game_id", currrent_game_id=int(currrent_game_id) + 1)
64+
store.put("latest_game_id", id=int(currrent_game_id) + 1)
6565
game_id = store.get("latest_game_id")["id"]
6666
plug_array = sample(ascii_uppercase, 20)
6767
plugs = []
6868
for i in range(10):
6969
plugs.append("".join(plug_array[i * 2:i * 2 + 2]))
7070
plug_settings = " ".join(x for x in plugs)
7171
rotors = sample(ascii_uppercase, 3)
72+
rotor_setting = "".join(rotors)
7273
App.get_running_app().machine.from_key_sheet(
7374
rotors="I II III",
7475
reflector="B",
7576
ring_settings=[1, 20, 11],
7677
plugboard_settings=plug_settings
7778
)
78-
App.get_running_app().machine.set_display("".join(rotors))
79+
App.get_running_app().machine.set_display(rotor_setting)
7980

8081
"""Storing data"""
8182
rotors.append(None)
8283
rotors.append(None)
8384
text = get_wiki_summary()
84-
store.put(game_id,
85-
ciphered_text=get_encrypted_text(text, rotors, plug_settings),
86-
unciphered_text=text,
87-
encrypted_state={
88-
"reflector": "B",
89-
"rotors": rotors,
90-
"plugs": plugs
91-
},
92-
current_state={
93-
"reflector": "B",
94-
"rotors": ["A", "A", "A", None, None],
95-
"plugs": [
96-
"AB",
97-
"CD",
98-
"EF",
99-
"GH",
100-
"IJ",
101-
"KL",
102-
"MN",
103-
"OP",
104-
"QR",
105-
"ST"
106-
]
107-
},
108-
last_saved_state={
109-
"reflector": "B",
110-
"rotors": ["A", "A", "A", None, None],
111-
"plugs": [
112-
"AB",
113-
"CD",
114-
"EF",
115-
"GH",
116-
"IJ",
117-
"KL",
118-
"MN",
119-
"OP",
120-
"QR",
121-
"ST"
122-
]
123-
}
124-
)
85+
store.put(
86+
game_id,
87+
ciphered_text=get_encrypted_text(text, rotor_setting, plug_settings),
88+
unciphered_text=text,
89+
encrypted_state={
90+
"reflector": "B",
91+
"rotors": rotors,
92+
"plugs": plugs
93+
},
94+
current_state={
95+
"reflector": "B",
96+
"rotors": ["A", "A", "A", None, None],
97+
"plugs": [
98+
"AB", "CD", "EF", "GH", "IJ",
99+
"KL", "MN", "OP", "QR", "ST"
100+
]
101+
},
102+
last_saved_state={
103+
"reflector": "B",
104+
"rotors": ["A", "A", "A", None, None],
105+
"plugs": [
106+
"AB", "CD", "EF", "GH", "IJ",
107+
"KL", "MN", "OP", "QR", "ST"
108+
]
109+
}
110+
)
125111

126112

127113
class GameScreen(Screen):

0 commit comments

Comments
 (0)