This commit is contained in:
parent
9e7f15d57a
commit
ade5101030
|
@ -99,13 +99,13 @@ def check_possible(field, row, col):
|
|||
|
||||
if ship_direction == 0:
|
||||
if field_size - row >= ship_size:
|
||||
for r in range(row, row + ship_size):
|
||||
for r in range(col, col + ship_size):
|
||||
if check_blocked(field, row, col):
|
||||
return True
|
||||
|
||||
if ship_direction == 1:
|
||||
if field_size - col >= ship_size:
|
||||
for c in range(col, col + ship_size):
|
||||
for c in range(row, row + ship_size):
|
||||
if check_blocked(field, row, col):
|
||||
return True
|
||||
|
||||
|
@ -155,11 +155,11 @@ colorize(my_field, buttons)
|
|||
|
||||
# print(blocked_string[:-2] + ' ' + ship_string[:-2])
|
||||
|
||||
for r in range(0, field_size):
|
||||
blocked_string = ''
|
||||
ship_string = ''
|
||||
for c in range(0, field_size):
|
||||
blocked_string += str(check_possible(my_field, r, c))[0] + ', '
|
||||
ship_string += my_field[r * field_size + c] + ', '
|
||||
# for r in range(0, field_size):
|
||||
# blocked_string = ''
|
||||
# ship_string = ''
|
||||
# for c in range(0, field_size):
|
||||
# blocked_string += str(check_possible(my_field, r, c))[0] + ', '
|
||||
# ship_string += my_field[r * field_size + c] + ', '
|
||||
|
||||
print(blocked_string[:-2] + ' ' + ship_string[:-2])
|
||||
# print(blocked_string[:-2] + ' ' + ship_string[:-2])
|
Loading…
Reference in New Issue