@@ -91,7 +91,8 @@ def apply_effects (counters, player_stats, boss_stats):
9191 if part_to_test == 2 :
9292 player_stats [1 ] -= 1
9393 if player_stats [1 ] <= 0 :
94- print ('Boss wins' )
94+ if verbose_level >= 2 :
95+ print ('Boss wins' )
9596 break
9697
9798 # Apply effects
@@ -102,14 +103,16 @@ def apply_effects (counters, player_stats, boss_stats):
102103
103104 # Apply player move
104105 if spells [player_action ][0 ] > player_stats [0 ]:
105- print ('Aborting: not enough mana' )
106+ if verbose_level >= 2 :
107+ print ('Aborting: not enough mana' )
106108 break
107109 if spells [player_action ][1 ] == 1 :
108110 player_stats [1 ] += spells [player_action ][3 ]
109111 boss_stats [0 ] -= spells [player_action ][2 ]
110112 else :
111113 if counters [player_action ] != 0 :
112- print ('Aborting: reused ' + player_action )
114+ if verbose_level >= 2 :
115+ print ('Aborting: reused ' + player_action )
113116 break
114117 else :
115118 counters [player_action ] = spells [player_action ][1 ]
@@ -120,7 +123,8 @@ def apply_effects (counters, player_stats, boss_stats):
120123 print (counters , player_stats , boss_stats )
121124
122125 if boss_stats [0 ] <= 0 :
123- print ('Player wins with' , mana_used , 'mana used' )
126+ if verbose_level >= 2 :
127+ print ('Player wins with' , mana_used , 'mana used' )
124128 min_mana_used = min (min_mana_used , mana_used )
125129 break
126130 if mana_used > min_mana_used :
@@ -140,7 +144,8 @@ def apply_effects (counters, player_stats, boss_stats):
140144 print (counters , player_stats , boss_stats )
141145
142146 if player_stats [1 ] <= 0 :
143- print ('Boss wins' )
147+ if verbose_level >= 2 :
148+ print ('Boss wins' )
144149 break
145150else :
146151 max_moves = 15
@@ -152,7 +157,8 @@ def apply_effects (counters, player_stats, boss_stats):
152157 for strategy in itertools .product (spells .keys (), repeat = max_moves ):
153158 count_strategies -= 1
154159 if 'S' not in strategy [0 :4 ] or 'R' not in strategy [0 :5 ]:
155- print (' Missing Shield or Recharge' )
160+ if verbose_level >= 2 :
161+ print (' Missing Shield or Recharge' )
156162 continue
157163 if any ([True for i in range (1 , max_moves ) if strategy [0 :i ] in pruned_strategies ]):
158164 print (' Pruned' )
@@ -175,7 +181,8 @@ def apply_effects (counters, player_stats, boss_stats):
175181 # Player turn
176182 player_hp -= 1
177183 if player_hp <= 0 :
178- print ('Boss wins' )
184+ if verbose_level >= 2 :
185+ print ('Boss wins' )
179186# pruned_strategies.append(tuple(actions_done))
180187 break
181188
@@ -198,7 +205,8 @@ def apply_effects (counters, player_stats, boss_stats):
198205
199206 # Apply player move
200207 if spells [player_action ][0 ] > player_mana :
201- print ('Aborting: not enough mana' )
208+ if verbose_level >= 2 :
209+ print ('Aborting: not enough mana' )
202210# pruned_strategies.append(actions_done)
203211 break
204212 # Missile
@@ -215,34 +223,39 @@ def apply_effects (counters, player_stats, boss_stats):
215223 # Shield
216224 elif player_action == 'S' :
217225 if shield_left != 0 :
218- print ('Aborting: reused ' + player_action )
226+ if verbose_level >= 2 :
227+ print ('Aborting: reused ' + player_action )
219228# pruned_strategies.append(actions_done)
220229 break
221230 else :
222231 shield_left = 6
223232 # Poison
224233 elif player_action == 'P' :
225234 if poison_left != 0 :
226- print ('Aborting: reused ' + player_action )
235+ if verbose_level >= 2 :
236+ print ('Aborting: reused ' + player_action )
227237# pruned_strategies.append(actions_done)
228238 break
229239 else :
230240 poison_left = 6
231241 # Recharge
232242 elif player_action == 'R' :
233243 if recharge_left != 0 :
234- print ('Aborting: reused ' + player_action )
244+ if verbose_level >= 2 :
245+ print ('Aborting: reused ' + player_action )
235246# pruned_strategies.append(actions_done)
236247 break
237248 else :
238249 shield_left = 5
239250
240251 if boss_hp <= 0 :
241- print ('Player wins with' , mana_used , 'mana used' )
252+ if verbose_level >= 2 :
253+ print ('Player wins with' , mana_used , 'mana used' )
242254 min_mana_used = min (min_mana_used , mana_used )
243255 break
244256 if mana_used > min_mana_used :
245- print ('Aborting: too much mana used' )
257+ if verbose_level >= 2 :
258+ print ('Aborting: too much mana used' )
246259 break
247260
248261
@@ -263,7 +276,8 @@ def apply_effects (counters, player_stats, boss_stats):
263276 player_hp -= boss_dmg - player_armor
264277
265278 if player_hp <= 0 :
266- print ('Boss wins' )
279+ if verbose_level >= 2 :
280+ print ('Boss wins' )
267281# pruned_strategies.append(actions_done)
268282 break
269283 else :
0 commit comments