tictactoe.py
def utility(board):
    """
    Returns 1 if X has won the game, -1 if O has won, 0 otherwise.
    """

    # Get winner
    won = winner(board)

    # Check for X and O
    if won == X:
        return 1
    elif won == O:
        return -1
    else:
        return 0

    Returns 1 if X has won the game, -1 if O has won, 0 otherwise.
    
Returns 1 if X has won the game, -1 if O has won, 0 otherwise.
Returns 1 if X has won the game - 1 if O has won 0 otherwise .
def utility(board):
    won = winner(board)
    if won == X:
        return 1
    elif won == O:
        return -1
    else:
        return 0
def utility ( board ) : won = winner ( board ) if won == X : return 1 elif won == O : return - 1 else : return 0
Returns 1 if X has won the game, -1 if O has won, 0 otherwise.
Returns 1 if X has won the game - 1 if O has won 0 otherwise .
"""
    Returns 1 if X has won the game, -1 if O has won, 0 otherwise.
    """ # Get winner # Check for X and O
board