Python - Determine Tic-Tac-Toe Winner
问题 I am trying to write a code that determines the winner of a tic-tac-toe game. (This is for a college assignment) I have written the following function to do so: This code only checks for horizontal lines, I haven't added the rest. I feel that this is something that needs a bit of hardcoding. def iswinner(board, decorator): win = True for row in range(len(board)): for col in range(len(board)): if board[row][col] == decorator: win = True else: win = False break Where "board" is a 2D array of