George_Zagorsky_1

Консольные крестики нолики

Jan 6th, 2022
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.34 KB | None | 0 0
  1. # krestiki noliki
  2.  
  3.  
  4. pole_for_krestiki = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
  5. print('Field for the game : - ')
  6. for i in pole_for_krestiki:
  7.     print(i)
  8.  
  9. print('First should be zero and the second if exit ')
  10.  
  11. while True:
  12.     print('Print your step ')
  13.     step_i = int(input())
  14.     step_j = int(input())
  15.     if pole_for_krestiki[step_i - 1][step_j - 1] != str:
  16.         pole_for_krestiki[step_i - 1][step_j - 1] = 'ZERO'
  17.     else:
  18.         print('That field is not empty')
  19.  
  20.     print('Your field now is : ')
  21.     for i in pole_for_krestiki:
  22.         print(i)
  23.  
  24.     if pole_for_krestiki[0][0] == pole_for_krestiki[1][1] == pole_for_krestiki[2][2] == 'ZERO':
  25.         print('Zero won the game')
  26.         break
  27.     elif pole_for_krestiki[0][2] == pole_for_krestiki[1][1] == pole_for_krestiki[2][0] == 'ZERO':
  28.         print('Zero won the game')
  29.         break
  30.     elif pole_for_krestiki[0][0] == pole_for_krestiki[0][1] == pole_for_krestiki[0][2] == 'ZERO':
  31.         print('Zero win the game')
  32.         break
  33.     elif pole_for_krestiki[1][0] == pole_for_krestiki[1][1] == pole_for_krestiki[1][2] == 'ZERO':
  34.         print('Zero win the game ')
  35.         break
  36.     elif pole_for_krestiki[2][0] == pole_for_krestiki[2][1] == pole_for_krestiki[2][2] == 'ZERO':
  37.         print('Zero won the game')
  38.         break
  39.     elif pole_for_krestiki[0][0] == pole_for_krestiki[1][0] == pole_for_krestiki[2][0] == 'ZERO':
  40.         print('Zero won the game ')
  41.         break
  42.     elif pole_for_krestiki[0][1] == pole_for_krestiki[1][1] == pole_for_krestiki[2][1] == 'ZERO':
  43.         print('Zero won the game')
  44.         break
  45.     elif pole_for_krestiki[0][2] == pole_for_krestiki[1][2] == pole_for_krestiki[2][2] == 'ZERO':
  46.         print('Zero won the game')
  47.         break
  48.  
  49.     print('Now its start for exit step ')
  50.     print('Now print your step ')
  51.     step_for_exit_i = int(input())
  52.     step_for_exit_j = int(input())
  53.  
  54.     if pole_for_krestiki[step_for_exit_i - 1][step_for_exit_j - 1] != int:
  55.         pole_for_krestiki[step_for_exit_i - 1][step_for_exit_j - 1] = 'EXIT'
  56.     else:
  57.         print('That field is not empy')
  58.  
  59.     print('Now field is -- > ')
  60.     for i in pole_for_krestiki:
  61.         print(i)
  62.  
  63.     if pole_for_krestiki[0][0] == pole_for_krestiki[1][1] == pole_for_krestiki[2][2] == 'EXIT':
  64.         print('Exit won the game')
  65.         break
  66.     elif pole_for_krestiki[0][2] == pole_for_krestiki[1][1] == pole_for_krestiki[2][0] == 'EXIT':
  67.         print('Exit won the game')
  68.         break
  69.     elif pole_for_krestiki[0][0] == pole_for_krestiki[0][1] == pole_for_krestiki[0][2] == 'EXIT':
  70.         print('Exit win the game')
  71.         break
  72.     elif pole_for_krestiki[1][0] == pole_for_krestiki[1][1] == pole_for_krestiki[1][2] == 'EXIT':
  73.         print('Exit win the game ')
  74.         break
  75.     elif pole_for_krestiki[2][0] == pole_for_krestiki[2][1] == pole_for_krestiki[2][2] == 'EXIT':
  76.         print('Exit won the game')
  77.         break
  78.     elif pole_for_krestiki[0][0] == pole_for_krestiki[1][0] == pole_for_krestiki[2][0] == 'EXIT':
  79.         print('Exit won the game ')
  80.         break
  81.     elif pole_for_krestiki[0][1] == pole_for_krestiki[1][1] == pole_for_krestiki[2][1] == 'EXIT':
  82.         print('Exit won the game')
  83.         break
  84.     elif pole_for_krestiki[0][2] == pole_for_krestiki[1][2] == pole_for_krestiki[2][2] == 'EXIT':
  85.         print('Exit won the game')
  86.         break
  87.  
Advertisement
Add Comment
Please, Sign In to add comment