diff --git a/HNC/Exercises/Ship_Battle/main.py b/HNC/Exercises/Ship_Battle/main.py index a51a414..b9f93b0 100644 --- a/HNC/Exercises/Ship_Battle/main.py +++ b/HNC/Exercises/Ship_Battle/main.py @@ -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]) \ No newline at end of file +# print(blocked_string[:-2] + ' ' + ship_string[:-2]) \ No newline at end of file