diff --git a/HNS/Excercises/ShipCraft/Переделка/.idea/misc.xml b/HNS/Excercises/ShipCraft/Переделка/.idea/misc.xml
index a6218fe..94888fc 100644
--- a/HNS/Excercises/ShipCraft/Переделка/.idea/misc.xml
+++ b/HNS/Excercises/ShipCraft/Переделка/.idea/misc.xml
@@ -3,5 +3,5 @@
-
+
\ No newline at end of file
diff --git a/HNS/Excercises/ShipCraft/Переделка/.idea/workspace.xml b/HNS/Excercises/ShipCraft/Переделка/.idea/workspace.xml
index 112d8aa..e9563b6 100644
--- a/HNS/Excercises/ShipCraft/Переделка/.idea/workspace.xml
+++ b/HNS/Excercises/ShipCraft/Переделка/.idea/workspace.xml
@@ -5,7 +5,9 @@
+
+
@@ -46,13 +48,13 @@
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"git-widget-placeholder": "main",
- "last_opened_file_path": "C:/Users/Eduardo/Documents/Программирование с Артуром/HNS/hnc-eduard/HNS/Excercises/ShipCraft/Переделка"
+ "last_opened_file_path": "F:/hnc-eduard/HNS/Excercises/ShipCraft/Переделка",
+ "settings.editor.selected.configurable": "com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable"
}
}]]>
-
+
-
@@ -74,7 +76,6 @@
-
@@ -96,7 +97,6 @@
-
@@ -118,14 +118,12 @@
-
-
@@ -181,15 +179,4 @@
-
-
-
-
- file://$PROJECT_DIR$/main.py
- 155
-
-
-
-
-
\ No newline at end of file
diff --git a/HNS/Excercises/ShipCraft/Переделка/.idea/Переделка.iml b/HNS/Excercises/ShipCraft/Переделка/.idea/Переделка.iml
index d0876a7..8388dbc 100644
--- a/HNS/Excercises/ShipCraft/Переделка/.idea/Переделка.iml
+++ b/HNS/Excercises/ShipCraft/Переделка/.idea/Переделка.iml
@@ -2,7 +2,7 @@
-
+
\ No newline at end of file
diff --git a/HNS/Excercises/ShipCraft/Переделка/ShipField.py b/HNS/Excercises/ShipCraft/Переделка/ShipField.py
index e356a59..93ea149 100644
--- a/HNS/Excercises/ShipCraft/Переделка/ShipField.py
+++ b/HNS/Excercises/ShipCraft/Переделка/ShipField.py
@@ -28,7 +28,6 @@ class ShipField:
def from_json(self, obj):
self.field = obj['field']
self.ships = obj['ships']
- ShipField.field_size = obj['field_size']
self.field_mode = ShipMode.from_string(obj['field_mode'])
self.ship_size = obj['ship_size']
self.ship_direction = ShipDirection.from_string(obj['ship_direction'])
@@ -57,7 +56,7 @@ class ShipField:
elif self.field_mode == ShipMode.SHOOT:
shoot_result = self.shoot(row, col)
- return self.shoot(row, col) == ShootResult.EMPTY
+ return shoot_result == ShootResult.EMPTY
return False
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/GameMode.cpython-39.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/GameMode.cpython-39.pyc
index a3548cc..0da48c4 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/GameMode.cpython-39.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/GameMode.cpython-39.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipDirection.cpython-39.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipDirection.cpython-39.pyc
index d96d04c..d625625 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipDirection.cpython-39.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipDirection.cpython-39.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipField.cpython-39.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipField.cpython-39.pyc
index 7ed55d5..e3debad 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipField.cpython-39.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipField.cpython-39.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipMode.cpython-39.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipMode.cpython-39.pyc
index 23aaee9..08f1d89 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipMode.cpython-39.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipMode.cpython-39.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipView.cpython-39.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipView.cpython-39.pyc
index 3ff97a5..6ef88dc 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipView.cpython-39.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipView.cpython-39.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShootResult.cpython-39.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShootResult.cpython-39.pyc
index f4d78ee..55bc872 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShootResult.cpython-39.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShootResult.cpython-39.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/main.py b/HNS/Excercises/ShipCraft/Переделка/main.py
index bb835ab..bff55d1 100644
--- a/HNS/Excercises/ShipCraft/Переделка/main.py
+++ b/HNS/Excercises/ShipCraft/Переделка/main.py
@@ -44,18 +44,19 @@ def colorize(view):
field = view.ship_field
for i in range(len(field.field)):
bg = "white"
- if field[i] == "1" and not view.enemy:
+ if field.field[i] == "1" and not view.enemy:
bg = 'pink'
- if field[i] == "\\":
- bg = 'red'
- if field[i] == "0":
+ if field.field[i] == "\\":
+ bg = 'grey'
+ if field.field[i] == "0":
bg = 'black'
- if field[i] == "p":
+ if field.field[i] == "p":
bg = 'blue'
- if "+" in field[i] and view.enemy:
- bg = 'orange'
- if "r" in field[i]:
+ if field.field[i] == "r":
bg = 'red'
+ if "+" in field.field[i] and view.enemy:
+ bg = 'orange'
+
view.buttons[i].configure(bg=bg)
refresh_remaining_ships_label(view)
@@ -74,8 +75,9 @@ def left_button_click(view, row, col):
action_result = view.ship_field.action(row, col)
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:
my_row = random.randint(0, ShipField.field_size)
my_col = random.randint(0, ShipField.field_size - 1)
@@ -158,6 +160,7 @@ def next_game_mode():
update_game_mode()
+
def update_game_mode():
global game_mode
@@ -193,7 +196,7 @@ def update_game_mode():
savebutton.grid(column=start_column_my_field, row=load_button_row, columnspan=4)
loadbutton.grid(column=start_column_my_field + 6, row=load_button_row, columnspan=4)
- start_button.grid(column=start_column_my_field, row=load_button_row + 1, columnspan=4)
+ start_button.grid(column=start_column_my_field + 11, row=load_button_row, columnspan=4)
load_game_button.grid_forget()
exit_button.grid_forget()