def wins(state, player):
    """
    This function tests if a specific player wins. Possibilities:
    * Three rows    [X X X] or [O O O]
    * Three cols    [X X X] or [O O O]
    * Two diagonals [X X X] or [O O O]
    :param state: the state of the current board
    :param player: a human or a computer
    :return: True if the player wins
    """
    win_state = [[state[0][0], state[0][1], state[0][2]], [state[1][0],
        state[1][1], state[1][2]], [state[2][0], state[2][1], state[2][2]],
        [state[0][0], state[1][0], state[2][0]], [state[0][1], state[1][1],
        state[2][1]], [state[0][2], state[1][2], state[2][2]], [state[0][0],
        state[1][1], state[2][2]], [state[2][0], state[1][1], state[0][2]]]
    if [player, player, player] in win_state:
        return True
    else:
        return False
