def vivod():
for cell in area:
print(cell)
def check_winner():
if area[0][0] == "X" and area[0][1] == "X" and area[0][2] == "X":
return "X"
if area[1][0] == "X" and area[1][1] == "X" and area[1][2] == "X":
return "X"
if area[2][0] == "X" and area[2][1] == "X" and area[2][2] == "X":
return "X"
if area[0][0] == "X" and area[1][0] == "X" and area[2][0] == "X":
return "X"
if area[0][1] == "X" and area[1][1] == "X" and area[2][1] == "X":
return "X"
if area[0][2] == "X" and area[1][2] == "X" and area[2][2] == "X":
return "X"
if area[0][0] == "X" and area[1][1] == "X" and area[2][2] == "X":
return "X"
if area[0][2] == "X" and area[1][1] == "X" and area[2][0] == "X":
return "X"
if area[0][0] == "0" and area[0][1] == "0" and area[0][2] == "0":
return "0"
if area[1][0] == "0" and area[1][1] == "0" and area[1][2] == "0":
return "0"
if area[2][0] == "0" and area[2][1] == "0" and area[2][2] == "0":
return "0"
if area[0][0] == "0" and area[1][0] == "0" and area[2][0] == "0":
return "0"
if area[0][1] == "0" and area[1][1] == "0" and area[2][1] == "0":
return "0"
if area[0][2] == "0" and area[1][2] == "0" and area[2][2] == "0":
return "0"
if area[0][0] == "0" and area[1][1] == "0" and area[2][2] == "0":
return "0"
if area[0][2] == "0" and area[1][1] == "0" and area[2][0] == "0":
return "0"
return "*"
area = [['*', '*', '*'], ['*', '*', '*'], ['*', '*', '*']]
vivod()
# for turn in range(1, 10):
turn = 1
while turn < 10:
print(f'сейчас ход номер {turn}')
if turn % 2 == 0:
turn_char = '0'
print('ходят нолики')
else:
turn_char = 'X'
print('ходят крестики')
row = int(input('введите номер строки - 1,2,3: '))
row -= 1
column = int(input('введите номер столбца - 1,2,3: '))
column -= 1
if area[row][column] != '*':
print('эта клетка уже занята')
continue
else:
print('на эту клетку можно походить')
area[row][column] = turn_char
turn += 1
vivod()
if check_winner() == '0':
print('победа ноликов!')
cprint('0','red') in area
break
if check_winner() == 'X':
print('победа крестиков!')
break
if turn == 10 and check_winner() == '*':
print('ничья!')
break