For this problem, n is 4
Just writing it in LISP mostly. I have never seen the language, and tbh, I am a bit lost on it. Not to mention I went to go buy a book over the weekend and neither Borders nor Barns and Noble had one in stock....
The guy is kind of impossible though, he is very vague with what he wants but he wants our solutions to be super descriptive and detailed. I could write a DFS search, that isn't the issue...
The issue I was having, apart from trying to decipher what he actually wanted, was coming up with a way to take the state, no matter which one, and generate it's possible child states (there aren't many) and then recall it. So I basically needed to build the "tree" and then search it.
Here is a bit from the project assignment:
Quote:
Define a function, called path, to implement the search algorithm. The function path should take as arguments a state and a goal and first check to see whether they are equal, indicating a successful termination of the search. If they are not equal, path should generate all four of the neighboring states in the state space graph, calling itself recursively on each of these neighboring states in turn to try to find a path from them to a goal. Note that you need to make sure path does not get stuck in a loop (visits a certain state more than once).
Now, if you actually look at the state-space, there aren't any valid states where there are 4 children... there is actually only one state, that has 2 children and the rest have 1, it is a pretty simple graph imo... however, if we included all the possible states, I am not sure there would be ONLY 4 moves if you included everything, there in lies the problem...
So really, I wasted too much time trying to figure out what he wanted, rather than just solving the problem, so I ran out of time to actually do it. Then it also boils down to not having any familiarity with LISP. If this was C/C++/C# etc I could have done it and the report in a couple of hours...