public List<M> search(Node<P, M> node){
        //避免对同一个位置进行重复搜索
        if (!seen.contains(node.pos))
        {
            seen.add(node.pos);
            if(puzzle.isGoal(node.pos)){
                return node.asMoveList();
            }
            
            for (M move:puzzle.legalMoves(node.pos))
            {
                P pos = puzzle.move(node.pos, move);
                Node<P, M> child = new Node<P, M>(pos, move, node);
                List<M> result = search(child);
                if (result!=null)
                {
                    return result;
                }
            }
        }
        return null;
        
    }