def player_has_won(player):
    """ Returns True iff the given player (1 or 2) has won the game. """

    # we need to check if there are three of the player's marks in a row,
    # so we'll keep comparing against a list of three in a row.
    MARK = get_mark(player)
    win = [MARK, MARK, MARK]

    # first check horizontal rows
    if get_row(1) == win or get_row(2) == win or get_row(3) == win:
        return True

    # no horizontal row, let's try vertical rows
    if get_column(A) == win or get_column(B) == win or get_column(C) == win:
        return True

    # no vertical either, let's try the diagonals
    if get_diagonal((1, A)) == win or get_diagonal((1, C)) == win:
        return True

    return False    # none of the above, player hasn't won
 Returns True iff the given player (1 or 2) has won the game. 
recipes/Python/576661_TicTacToe/recipe-576661.py