fix some bugs
This commit is contained in:
parent
14c0a3ba01
commit
112b9a1394
|
@ -4,7 +4,11 @@
|
||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="b389cdea-22f5-4ba2-8b46-337091984b3c" name="Changes" comment="код по 22 части урока" />
|
<list default="true" id="b389cdea-22f5-4ba2-8b46-337091984b3c" name="Changes" comment="код по 22 части урока">
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ShipField.py" beforeDir="false" afterPath="$PROJECT_DIR$/ShipField.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||||
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
|
|
@ -102,7 +102,7 @@ class ShipField:
|
||||||
if shoot_result == ShootResult.KILLED:
|
if shoot_result == ShootResult.KILLED:
|
||||||
self.fill_empty_killed(row, col)
|
self.fill_empty_killed(row, col)
|
||||||
|
|
||||||
return shoot_result == ShootResult.UNDEFINED
|
return shoot_result == ShootResult.EMPTY
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
Binary file not shown.
|
@ -74,12 +74,12 @@ def left_button_click(view, row, col):
|
||||||
|
|
||||||
action_result = view.ship_field.action(row, col)
|
action_result = view.ship_field.action(row, col)
|
||||||
|
|
||||||
if action_result and view_enemy and game_mode == GameMode.Battle:
|
if action_result and view.enemy and game_mode == GameMode.BATTLE:
|
||||||
# Ход соперника
|
# Ход соперника
|
||||||
enemy_shoot_result = ShootResult.UNDEFINED
|
enemy_shoot_result = ShootResult.UNDEFINED
|
||||||
|
|
||||||
while enemy_shoot_result != ShootResult.EMPTY:
|
while enemy_shoot_result != ShootResult.EMPTY:
|
||||||
my_row = random.randint(0, ShipField.field_size)
|
my_row = random.randint(0, ShipField.field_size - 1)
|
||||||
my_col = random.randint(0, ShipField.field_size - 1)
|
my_col = random.randint(0, ShipField.field_size - 1)
|
||||||
|
|
||||||
enemy_shoot_result = my_view.ship_field.shoot(my_row, my_col)
|
enemy_shoot_result = my_view.ship_field.shoot(my_row, my_col)
|
||||||
|
|
Loading…
Reference in New Issue