diff --git a/HNS/Excercises/ShipCraft/Переделка/.idea/misc.xml b/HNS/Excercises/ShipCraft/Переделка/.idea/misc.xml
index 94888fc..a6218fe 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 85e0d35..1c7db57 100644
--- a/HNS/Excercises/ShipCraft/Переделка/.idea/workspace.xml
+++ b/HNS/Excercises/ShipCraft/Переделка/.idea/workspace.xml
@@ -5,7 +5,9 @@
+
+
@@ -38,21 +40,22 @@
- {
+ "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": "C:/Users/Eduardo/Documents/Программирование с Артуром/hnc-eduard/HNS/Excercises/ShipCraft/Переделка",
+ "settings.editor.selected.configurable": "configurable.group.editor"
}
-}]]>
+}
+
@@ -74,6 +77,7 @@
+
@@ -95,38 +99,18 @@
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -137,9 +121,8 @@
-
-
+
diff --git a/HNS/Excercises/ShipCraft/Переделка/.idea/Переделка.iml b/HNS/Excercises/ShipCraft/Переделка/.idea/Переделка.iml
index 8388dbc..909438d 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 3671d15..9e44475 100644
--- a/HNS/Excercises/ShipCraft/Переделка/ShipField.py
+++ b/HNS/Excercises/ShipCraft/Переделка/ShipField.py
@@ -3,6 +3,7 @@ import copy
from ShootResult import ShootResult
from ShipDirection import ShipDirection
from ShipMode import ShipMode
+from tkinter import StringVar
class ShipField:
@@ -44,8 +45,6 @@ class ShipField:
return None
-
-
def mark_killed(self, row, col):
if row < 0 or row > ShipField.field_size:
return
@@ -55,7 +54,6 @@ class ShipField:
self.field[row * ShipField.field_size + col] = 'x'
self.fill_empty_killed(row, col)
-
#check vertical
for r in range(row + 1, ShipField.field_size):
if self.check_damaged(r, col):
diff --git a/HNS/Excercises/ShipCraft/Переделка/__pycache__/GameMode.cpython-311.pyc b/HNS/Excercises/ShipCraft/Переделка/__pycache__/GameMode.cpython-311.pyc
index 2633edb..0053f96 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 44876d4..54488f3 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 03935f7..c9b1bd9 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 e7d1ce2..723ddce 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 2f869e8..e1edb72 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 4a68bab..5754a10 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 79d0203..38d2c33 100644
--- a/HNS/Excercises/ShipCraft/Переделка/main.py
+++ b/HNS/Excercises/ShipCraft/Переделка/main.py
@@ -150,6 +150,16 @@ def refresh_remaining_ships_label(view):
view.remaining_ship_text.set(text[:-2])
+def determine_winner():
+ if my_field.check_end():
+ winner_lable = "You won!"
+ elif my_field.check_end():
+ winner_lable = "Your enemy won!"
+ else:
+ winner_lable = ""
+ return winner_lable
+
+
def next_game_mode():
global game_mode
@@ -244,6 +254,7 @@ def update_game_mode():
load_game_button.grid_forget()
exit_button.grid_forget()
end_button.grid(column=start_column_enemy_field, row=load_button_row, columnspan=4)
+ lbl_winner.grid(column=start_column_enemy_field, row=load_button_row + 2, columnspan=2)
hide_view(my_view)
hide_view(enemy_view)
@@ -270,6 +281,7 @@ load_button_row = start_row_my_field + ShipField.field_size + 1
my_view = create_view(window, False)
enemy_view = create_view(window, True)
+winner_lable = StringVar
lbl_left_vertical = Label(window, text='', width=5, height=2)
lbl_center_vertical = Label(window, text='', width=5, height=2)
@@ -285,6 +297,8 @@ start_button = Button(window, text='START', width=20, height=2, command=next_gam
load_game_button = Button(window, text='LOAD', width=20, height=2)
exit_button = Button(window, text='EXIT', width=20, height=2)
end_button = Button(window, text='BACK TO MENU', width=20, height=2, command=next_game_mode)
+lbl_winner = Label(window, text='', width=20, height=2, textvariable=determine_winner)
+
game_mode = GameMode.MENU
update_game_mode()