I'm having a hard time understanding what to do with task 5. I have everything setup to this point including both heuristic functions, but I'm not sure of what the ending structure should look like. Could I get someone to point me in the right direction?
I just followed the description in the project:
ReplyDeleteCreate a new function that takes a node as an argument. A node is defined in the project description as:
(defstruct node
STATE ;;the state of the problem corresponding to this node
PARENT ;;the node which is this nodes' parent
ACTION ;;the action which was taken at the nodes parent to get here
G-VAL ;;The g-value of the node
H-VAL ;;THe h-value of the node
F-VAL ;;THE f-value of the node
)
So the function for task 5 takes a node "n" as input, uses the function from task 2 to generate a list of action/node pairs that are child states of the state in "n". Then it creates a new node for each of these child states, assigning the action to the new nodes ACTION, the state to the new nodes STATE, the f value, the g value, etc.
Then, you return a list of all these new nodes you just created.
Here's the page I used to learn how structs work in Common Lisp:
http://www.chemie.fu-berlin.de/chemnet/use/info/cl/cl_12.html