Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Решение с матрица:
- matrix = []
- for i in range(3):
- matrix.append(input().split())
- if matrix[0][0] == matrix[0][1] == matrix[0][2] == '1' \
- or matrix[1][0] == matrix[1][1] == matrix[1][2] == '1' \
- or matrix[2][0] == matrix[2][1] == matrix[2][2] == '1' \
- or matrix[0][0] == matrix[1][0] == matrix[2][0] == '1' \
- or matrix[0][1] == matrix[1][1] == matrix[2][1] == '1' \
- or matrix[0][2] == matrix[1][2] == matrix[2][2] == '1' \
- or matrix[0][0] == matrix[1][1] == matrix[2][2] == '1' \
- or matrix[0][2] == matrix[1][1] == matrix[2][0] == '1': print("First player won")
- elif matrix[0][0] == matrix[0][1] == matrix[0][2] == '2' \
- or matrix[1][0] == matrix[1][1] == matrix[1][2] == '2' \
- or matrix[2][0] == matrix[2][1] == matrix[2][2] == '2' \
- or matrix[0][0] == matrix[1][0] == matrix[2][0] == '2' \
- or matrix[0][1] == matrix[1][1] == matrix[2][1] == '2' \
- or matrix[0][2] == matrix[1][2] == matrix[2][2] == '2' \
- or matrix[0][0] == matrix[1][1] == matrix[2][2] == '2' \
- or matrix[0][2] == matrix[1][1] == matrix[2][0] == '2': print("Second player won")
- else:
- print("Draw!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement