diff --git a/HNS/Excercises/ShipCraft/Переделка.rar b/HNS/Excercises/ShipCraft/Переделка.rar
deleted file mode 100644
index e528496..0000000
Binary files a/HNS/Excercises/ShipCraft/Переделка.rar and /dev/null differ
diff --git a/HNS/Excercises/ShipCraft/Переделка.zip b/HNS/Excercises/ShipCraft/Переделка.zip
new file mode 100644
index 0000000..a0283be
Binary files /dev/null and b/HNS/Excercises/ShipCraft/Переделка.zip differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/.idea/workspace.xml b/HNS/Excercises/ShipCraft/Переделка/.idea/workspace.xml
index cb52cbc..084bbb2 100644
--- a/HNS/Excercises/ShipCraft/Переделка/.idea/workspace.xml
+++ b/HNS/Excercises/ShipCraft/Переделка/.idea/workspace.xml
@@ -5,14 +5,9 @@
-
-
-
-
-
-
+
-
+
@@ -44,20 +39,21 @@
- {
- "keyToString": {
- "Python.ShipField.executor": "Run",
- "Python.main (1).executor": "Run",
- "Python.main.executor": "Run",
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "git-widget-placeholder": "main",
- "last_opened_file_path": "Z:/Documents/Обучение с Новым Кодом (Артур)/Git/hnc-eduard/HNS/Excercises/ShipCraft/Переделка"
+
+}]]>
+
@@ -79,6 +75,7 @@
+
@@ -100,6 +97,7 @@
+
@@ -121,12 +119,14 @@
+
+
@@ -152,7 +152,7 @@
-
+
@@ -187,7 +187,7 @@
file://$PROJECT_DIR$/main.py
- 135
+ 147
diff --git a/HNS/Excercises/ShipCraft/Переделка/ShipField.py b/HNS/Excercises/ShipCraft/Переделка/ShipField.py
index 0501ff8..9ef9241 100644
--- a/HNS/Excercises/ShipCraft/Переделка/ShipField.py
+++ b/HNS/Excercises/ShipCraft/Переделка/ShipField.py
@@ -56,7 +56,10 @@ class ShipField:
self.set_ship(row, col)
elif self.field_mode == ShipMode.SHOOT:
- self.shoot(row, col)
+ shoot_result = self.shoot(row, col)
+ return self.shoot(row, col) == ShootResult.EMPTY
+
+ return False
def target(self, row, col):
self.clear_marker()
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/GameMode.cpython-311.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/GameMode.cpython-311.pyc
index 4d3f14e..2633edb 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/GameMode.cpython-311.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/GameMode.cpython-311.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipDirection.cpython-311.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipDirection.cpython-311.pyc
index 45fb80f..44876d4 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipDirection.cpython-311.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipDirection.cpython-311.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipField.cpython-311.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipField.cpython-311.pyc
index 8c7daeb..a7bfd38 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipField.cpython-311.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipField.cpython-311.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipMode.cpython-311.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipMode.cpython-311.pyc
index 51e36d4..e7d1ce2 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipMode.cpython-311.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipMode.cpython-311.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipView.cpython-311.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipView.cpython-311.pyc
index 45adcd3..2f869e8 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipView.cpython-311.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShipView.cpython-311.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShootResult.cpython-311.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShootResult.cpython-311.pyc
index 2ee7306..4a68bab 100644
Binary files a/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShootResult.cpython-311.pyc and b/HNS/Excercises/ShipCraft/Переделка/__pycache__/ShootResult.cpython-311.pyc differ
diff --git a/HNS/Excercises/ShipCraft/Переделка/main.py b/HNS/Excercises/ShipCraft/Переделка/main.py
index b080607..75a19e6 100644
--- a/HNS/Excercises/ShipCraft/Переделка/main.py
+++ b/HNS/Excercises/ShipCraft/Переделка/main.py
@@ -1,5 +1,6 @@
import json
import os
+import random
import time
from tkinter import *
from tkinter import filedialog
@@ -7,6 +8,7 @@ from ShipView import ShipView
from ShipMode import ShipMode
from ShipField import ShipField
from GameMode import GameMode
+from ShootResult import ShootResult
active_view = {}
@@ -69,7 +71,17 @@ def keypress_handler(e):
def left_button_click(view, row, col):
- view.ship_field.action(row, col)
+ if view.ship_field.action(row, col) and view_enemy and game_mode == GameMode.Battle:
+ 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)
+
+ enemy_shoot_result= my_view.ship_field.shoot(my_row, my_col)
+
+
+
colorize(view)
@@ -162,7 +174,7 @@ def update_game_mode():
elif game_mode == GameMode.PLAN:
window.geometry('1020x640')
- load_field(view, file_path)
+ load_field(enemy_view, "default.json")
my_view.ship_field.set_field_mode(ShipMode.PUT)
enemy_view.ship_field.set_field_mode(ShipMode.INACTIVE)