def _find_moves(game:Othello) -> list:
    """
    This function finds all available moves on the board for the AI and returns the result as a list of tuples.
    :rtype : list
    :param game: Othello
    """
    result = []
    for row in range(game.rows()):
        for column in range(game.columns()):
            if game.cell(row + 1, column + 1) == EMPTY:
                if othello_game_logic._check_move(row + 1, column + 1, game._game_state):
                    result.append((row + 1, column + 1))
    return result
Ejemplo n.º 2
0
def _find_moves(game: Othello) -> list:
    """
    This function finds all available moves on the board for the AI and returns the result as a list of tuples.
    :rtype : list
    :param game: Othello
    """
    result = []
    for row in range(game.rows()):
        for column in range(game.columns()):
            if game.cell(row + 1, column + 1) == EMPTY:
                if othello_game_logic._check_move(row + 1, column + 1,
                                                  game._game_state):
                    result.append((row + 1, column + 1))
    return result
Ejemplo n.º 3
0
def _board(game: Othello) -> None:
    """
    This function prints the game board to the console.
    :rtype : None
    :param game: Othello
    """
    rows = game.rows()
    columns = game.columns()
    for column in range(columns):
        if column < 1:
            print('{:>5}'.format(column + 1), end='')

        else:
            print('{:>3}'.format(column + 1), end='')

    print()

    for row in range(rows):
        print('{:>2}'.format(row + 1), end='')
        for column in range(columns):
            print('{:>3}'.format(game.cell(row + 1, column + 1)), end='')
        print()