Spaces:
Sleeping
Sleeping
map coloring
Browse files- helper_functions.py +9 -5
helper_functions.py
CHANGED
@@ -119,17 +119,21 @@ def check_end(trump_response):
|
|
119 |
|
120 |
|
121 |
def process_ending(idea_is_accepted, game_number, idea):
|
122 |
-
|
123 |
-
|
124 |
-
f.write(idea + '\n')
|
125 |
|
126 |
world_graph = WorldGraph(f'games/game_{game_number}/world_graph.edgelist')
|
127 |
|
128 |
with open(f'games/game_{game_number}/round_consequences.json', 'r',encoding='utf-8') as f:
|
129 |
-
|
130 |
-
|
|
|
131 |
delta_USA = int(consequences['delta_USA'])
|
132 |
delta_country = int(consequences['delta_country'])
|
133 |
delta_friendliness = int(consequences['delta_friendliness'])
|
|
|
|
|
|
|
|
|
134 |
|
135 |
world_graph.update_world(country, delta_USA, delta_country, delta_friendliness, game_number)
|
|
|
119 |
|
120 |
|
121 |
def process_ending(idea_is_accepted, game_number, idea):
|
122 |
+
with open(f'games/game_{game_number}/events.list', 'a',encoding='utf-8') as f:
|
123 |
+
f.write(idea + '\n')
|
|
|
124 |
|
125 |
world_graph = WorldGraph(f'games/game_{game_number}/world_graph.edgelist')
|
126 |
|
127 |
with open(f'games/game_{game_number}/round_consequences.json', 'r',encoding='utf-8') as f:
|
128 |
+
consequences = json.load(f)
|
129 |
+
country = consequences['country']
|
130 |
+
if idea_is_accepted:
|
131 |
delta_USA = int(consequences['delta_USA'])
|
132 |
delta_country = int(consequences['delta_country'])
|
133 |
delta_friendliness = int(consequences['delta_friendliness'])
|
134 |
+
if not idea_is_accepted:
|
135 |
+
delta_USA = 0
|
136 |
+
delta_country = 0
|
137 |
+
delta_friendliness = -int(consequences['delta_friendliness'])
|
138 |
|
139 |
world_graph.update_world(country, delta_USA, delta_country, delta_friendliness, game_number)
|