Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- batle_map_p1 = [[' ' for j in range(10)] for i in range(10)]
- batle_map_p2 = [[' ' for g in range(10)] for h in range(10)]
- alphabet = 'АБВГДЕЖЗИК'
- vert_line = dict([(i, alphabet[i]) for i in range(10)])
- alphabet_dict = dict((key, value) for value, key in vert_line.items())
- batle_ship = {4: [[]], 3: [[], []], 2: [[], [], []], 1: [[], [], [], []]}
- def line_():
- print(' ', end='')
- for __ in range(10):
- print(' -', end='')
- print('')
- def num(list):
- print('|', end='')
- for i in list:
- print(f'{i}|', end='')
- print('')
- def print_map(map):
- print(' ', end='')
- for i in range(10):
- print(i + 1, end=' ')
- print('')
- for i in range(10):
- line_()
- print(vert_line[i], end='')
- num(map[i])
- line_()
- def check(str_coordinat):
- if len(str_coordinat)==2 and isinstance(str, str_coordinat[0]) and isinstance(int, str_coordinat[1]):
- if str_coordinat[0] in alphabet and 0<int(str_coordinat[1])<11:
- return True
- return False
- print_map(batle_map_p1)
- for i in range(4):
- for j in range(4-i):
- if i>0:
- print(f'Введить координаты начала и конца (через пробел) вашего {i+1} палубника')
- coordinat = input().split()
- while not (len(coordinat)==2 and check(coordinat[0]) and check(coordinat[1])):
- coordinat = input().split()
- for g in range(2):
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement