Your homework should not only perform the search to find the goal from the start, but should also produce the path in console output. Once the "goal node" has been returned from the tree search function, you must process the path and this is a brief explanation. If you follow the "Expand" pseudocode, each node keeps its current state, the action that led to it, and the parent node. From this, once you reach the goal state, you can trace back through the parents to get back to the initial state. Each node (except the parent) tells you the action it took to get to them. If you push this action on a stack and then move to the parent until you hit the initial state, you can make a list of the actions to take to get to the goal. I'll demonstrate with some code. node * current = goalnode; stack actionlist; while(current != parentnode) { actionlist.push(current->action); current = current->parent; } //this produces a stack of actions - then you just need a loop to print the actions in order while( ! actionlist.empty() ) { actions a = actionlist.top(); actionlist.pop(); cout << a.m << " " << a.c << " " << a.b << endl; } Imagine this. The solution goes from states A B and C and to get from A-B you perform action zebra and to get from B to C you perform action elephant. when the tree is done you have a node that encodes the state C, the action elephant and has a pointer to a node that encodes state B. so current = node C (with state C, elephant and parent B) stack is empty current isn't parent node push action elephant onto action list (bottom of stack) current is parent of C or node B with state B, zebra and parent A current isn't parent node push action zebra onto action list (stack is now zebra on top elephant on bottom) current is parent of node B with state A, no action and parent NULL current is parent node - quit while loop actionlist is not empty print zebra pop zebra actionlist is not empty print elephant pop elephant actionlist empty - quit while loop so console will now read: zebra, elephant which are the steps to the solution