(player)
| 12 | print() |
| 13 | |
| 14 | def check_winner(player): |
| 15 | win_conditions = [ |
| 16 | [0,1,2], [3,4,5], [6,7,8], # rows |
| 17 | [0,3,6], [1,4,7], [2,5,8], # columns |
| 18 | [0,4,8], [2,4,6] # diagonals |
| 19 | ] |
| 20 | for condition in win_conditions: |
| 21 | if all(board[i] == player for i in condition): |
| 22 | return True |
| 23 | return False |
| 24 | |
| 25 | def is_draw(): |
| 26 | return " " not in board |