Esempio n. 1
0
def all_potential_moves(current_state, player):
    squares = range(64)
    prelude = lambda square: PotentialMove(square, rules.get_flips(current_state, turn=player, square_id=square))
    
    return map(
        prelude,
        filter(
            lambda square: rules.is_move_valid(current_state, player, square) == "Valid",
            squares,
        )
    )
Esempio n. 2
0
def all_potential_moves(current_state, player):
    squares = range(64)
    prelude = lambda square: PotentialMove(
        square, rules.get_flips(current_state, turn=player, square_id=square))

    return map(
        prelude,
        filter(
            lambda square: rules.is_move_valid(current_state, player, square)
            == "Valid",
            squares,
        ))
Esempio n. 3
0
def is_move_valid(current_state, player, square):
    if isinstance(square, tuple):
        square = _tuple_to_square_id(square)

    return rules.is_move_valid(current_state, turn=player, square_id=square)
Esempio n. 4
0
def is_move_valid(current_state, player, square):
    if isinstance(square, tuple):
        square = _tuple_to_square_id(square)
    
    return rules.is_move_valid(current_state, turn=player, square_id=square)