def rule_6(self, moves, game, pieces, data): """ try to create bridges across other players gaps if at all possible. """ metric = [] test_board = copy.deepcopy(game.board) for move in moves: t_board = test_board t_piece = Piece( move['pieceID'], move['playerID'], rotation=move['rotation'], parity=move['parity']) position = move['position'] before = find_bridge_instances( t_board, game.current_playerID, position=move['position'], size=t_piece.geometry.shape) t_board = t_piece.place_on_board(t_board, position) after = find_bridge_instances( t_board, game.current_playerID, position=move['position'], size=t_piece.geometry.shape) # using before and after, encourages starting and crossing bridges metric += [before + after] return np.array(metric)
def rule_5(self, moves, game, pieces, data): """ try to share edge space with opponents as much as possible """ metric = [] test_board = copy.deepcopy(game.board) for move in moves: t_board = test_board t_piece = Piece( move['pieceID'], move['playerID'], rotation=move['rotation'], parity=move['parity']) position = move['position'] t_board = t_piece.place_on_board(t_board, position) after = find_edge_sharing( t_board, game.current_playerID, position=move['position'], size=t_piece.geometry.shape) # using before and after, encourages starting and crossing bridges metric += [after] return np.array(metric)