Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. batle_map_p1 = [[' ' for j in range(10)] for i in range(10)]
  2. batle_map_p2 = [[' ' for g in range(10)] for h in range(10)]
  3. alphabet = 'АБВГДЕЖЗИК'
  4. vert_line = dict([(i, alphabet[i]) for i in range(10)])
  5. alphabet_dict = dict((key, value) for value, key in vert_line.items())
  6. batle_ship = {4: [[]], 3: [[], []], 2: [[], [], []], 1: [[], [], [], []]}
  7.  
  8.  
  9. def line_():
  10. print(' ', end='')
  11. for __ in range(10):
  12. print(' -', end='')
  13. print('')
  14.  
  15.  
  16. def num(list):
  17. print('|', end='')
  18. for i in list:
  19. print(f'{i}|', end='')
  20. print('')
  21.  
  22.  
  23. def print_map(map):
  24. print(' ', end='')
  25. for i in range(10):
  26. print(i + 1, end=' ')
  27. print('')
  28. for i in range(10):
  29. line_()
  30. print(vert_line[i], end='')
  31. num(map[i])
  32. line_()
  33.  
  34.  
  35. def check(str_coordinat):
  36. if len(str_coordinat)==2 and isinstance(str, str_coordinat[0]) and isinstance(int, str_coordinat[1]):
  37. if str_coordinat[0] in alphabet and 0<int(str_coordinat[1])<11:
  38. return True
  39. return False
  40.  
  41.  
  42. print_map(batle_map_p1)
  43. for i in range(4):
  44.  
  45. for j in range(4-i):
  46. if i>0:
  47. print(f'Введить координаты начала и конца (через пробел) вашего {i+1} палубника')
  48. coordinat = input().split()
  49. while not (len(coordinat)==2 and check(coordinat[0]) and check(coordinat[1])):
  50. coordinat = input().split()
  51. for g in range(2):
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement