@@ -61,67 +61,53 @@ def setup_new_game_settings():
61
61
if currrent_game_id is None :
62
62
store .put ("latest_game_id" , id = 0 )
63
63
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 )
65
65
game_id = store .get ("latest_game_id" )["id" ]
66
66
plug_array = sample (ascii_uppercase , 20 )
67
67
plugs = []
68
68
for i in range (10 ):
69
69
plugs .append ("" .join (plug_array [i * 2 :i * 2 + 2 ]))
70
70
plug_settings = " " .join (x for x in plugs )
71
71
rotors = sample (ascii_uppercase , 3 )
72
+ rotor_setting = "" .join (rotors )
72
73
App .get_running_app ().machine .from_key_sheet (
73
74
rotors = "I II III" ,
74
75
reflector = "B" ,
75
76
ring_settings = [1 , 20 , 11 ],
76
77
plugboard_settings = plug_settings
77
78
)
78
- App .get_running_app ().machine .set_display ("" . join ( rotors ) )
79
+ App .get_running_app ().machine .set_display (rotor_setting )
79
80
80
81
"""Storing data"""
81
82
rotors .append (None )
82
83
rotors .append (None )
83
84
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
+ )
125
111
126
112
127
113
class GameScreen (Screen ):
0 commit comments