public ChessGameConfiguration[] search(ChessGameConfiguration cgc,List<? extends Piece> availablePieces){
        
       SearchEngineStep ses = new SearchEngineStep(cgc, availablePieces);
        
       this.pendingSearchSteps.add(ses);
       
       while(!this.pendingSearchSteps.isEmpty()){
           SearchEngineStep ses1 = this.pendingSearchSteps.poll();
           
           Cell[] board = ses1.getCgconfig().getCurrentBoard();
           List<? extends Piece> oldAvailablePieces = ses1.getAvailablePieces();
           
           if(oldAvailablePieces.isEmpty()){
               this.sucessfullChessGameConfigurations.add(ses1.getCgconfig());
           }else{                         
                List<Piece> newAvailablePieces;
                newAvailablePieces = new ArrayList<>(oldAvailablePieces.size());
                
                for(Piece piece:oldAvailablePieces){
                    newAvailablePieces.add(piece);
                }
                
                Piece pieceToPut = newAvailablePieces.remove(0);
                
                
                int cellPosition = 0;

                SearchEngineStep nextSearchStep;
                ChessGameConfiguration nextChessGameConfiguration;
                
                for(Cell boardCell: board){
                    if(boardCell == Cell.DEFAULT_EMPTY_CELL){
                        try{
                            nextChessGameConfiguration = ses1.getCgconfig().putPiece(pieceToPut, cellPosition);
                            nextSearchStep = new SearchEngineStep(nextChessGameConfiguration,newAvailablePieces);
                            
                            this.pendingSearchSteps.add(nextSearchStep);
                        }catch(IllegalMark exception){
                            //Nothing to do.
                            int i = 0;
                        }
                    }

                     cellPosition++;
                }
                }
       }
       
       ChessGameConfiguration[] results;
       int resultSize = this.sucessfullChessGameConfigurations.size();
       results = this.sucessfullChessGameConfigurations.toArray(new ChessGameConfiguration[resultSize]);
       
       return results;
    }