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, ) )
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, ))
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)