From f46f4acfb792b31448020f9b9892df34ab6a5a0b Mon Sep 17 00:00:00 2001 From: ehermakov Date: Mon, 27 Nov 2023 22:30:13 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B7=D0=B0=D0=B3=D1=80=D1=83=D0=B6=D0=B0?= =?UTF-8?q?=D1=8E=20=D0=B4=D0=B7=20=D0=B1=D0=B5=D0=B7=201=20=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HNS/Excercises/ShipCraft/main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HNS/Excercises/ShipCraft/main.py b/HNS/Excercises/ShipCraft/main.py index a4b9eb7..c98e1d6 100644 --- a/HNS/Excercises/ShipCraft/main.py +++ b/HNS/Excercises/ShipCraft/main.py @@ -6,7 +6,7 @@ buttons = [] field_size = 10 ship_size = 4 -ship_direction = 1 +ship_direction = 0 empty_field = [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', @@ -120,13 +120,13 @@ def check_possible(field, row, col): # Здесь мы знаем, что корабль помещается на поле. if field_size - row >= ship_size: # Теперь нужно проверить, не заблокировано ли какое-то из полей, - for i in range(row, row + ship_size + 1): + for i in range(row, row + ship_size): if check_blocked(field, row, col): return True if ship_direction == 1: if field_size - col >= ship_size: - for i in range(col, col + ship_size + 1): + for i in range(col, col + ship_size): if check_blocked(field, row, col): return True return False