void IDAStar::generateMovements(GameState* currentState,GameState* tempState,const BoxMovement& movement, std::priority_queue<GameState*,std::vector<GameState*>,GameStateComparator>& queue){ unsigned int numComponents =0; field components[4]; point evasionFields[4]; unsigned int numEvasionFields = 0; std::unordered_set<point, PointHasher, PointEqual> nodes; tempState->findAdjacentComponents(movement.dest(),numComponents,components); currentState->bfs(movement.bot == RPUSHER? currentState->pusher:currentState->puller,movement.srcBot(),nodes); nodes.insert(movement.destBot()); nodes.insert(movement.dest()); nodes.insert(movement.src()); currentState->findEvasionFields(movement.bot == RPUSHER? currentState->puller: currentState->pusher,numComponents, components, nodes, tempState,numEvasionFields,evasionFields); for(unsigned int i = 0; i< numEvasionFields; i++){ nodes.clear(); RobotMovement* rMove = currentState->path(movement.bot == RPUSHER?RPULLER:RPUSHER,evasionFields[i],nodes,MAXELEMENTS); if(rMove != NULL){ GameState* newState = currentState->copy(); newState->apply(rMove); //MapUtils::printMap(*newState,std::cout); nodes.insert(movement.dest()); nodes.insert(movement.destBot()); rMove = newState->path(movement.bot,movement.srcBot(),nodes,MAXELEMENTS); if(rMove == NULL){ delete newState; continue; } newState->apply(rMove); //MapUtils::printMap(*newState,std::cout); newState->apply(new BoxMovement(movement)); insertState(currentState,newState,queue); } } }