Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Generate successors/expansions of move
- map<int, Board*> potentialMoveMap;
- currentMove->_b->potentialMoves(potentialMoveMap);
- map<int,Board*>::iterator successor;
- // For each successor
- for(successor = potentialMoveMap.begin(); successor != potentialMoveMap.end(); successor++){
- // if the board of successor is not in the closed board set
- if(!closed_list.count(successor->second)){
- //Allocate memory for board and move
- Board* successorBoard = new Board(successor->second);
- PuzzleMove* successorMove = new PuzzleMove(successor->first,successorBoard,currentMove);
- // Compute f values for each potential move
- successorMove->score(ph);
- // Add the board of successor to the board set
- closed_list.insert(successor->second);
- // Add successorMove to the open_list
- open_list.push(successorMove);
- // Increment number of expansions
- _expansions++;
- }
- }
Add Comment
Please, Sign In to add comment