If the number modulo 2 not 1 than it moves vertically, else moves horizontally, and 0 is start car, now what I am thinking to do is to go through all the possible ways to solve the game, and then keep getting the minimum amount of moves, this algorithm should not be too hard BUT, it might run infinitely, any suggestions?
Posted: Sat Dec 15, 2012 6:47 pm Post subject: RE:Rush Hour Project
There's a finite number of moves and states. If it reaches a state you've been to before, don't go any further down that branch. Alternatively, you can set a limit on depth. If you're a hundred moves deep, don't go further down that branch.
Posted: Sat Dec 15, 2012 6:51 pm Post subject: RE:Rush Hour Project
So how would I map something that has already happened, is there a function for that?
Posted: Sat Dec 15, 2012 7:20 pm Post subject: RE:Rush Hour Project
There is no such function. However, you can save the map states as you progress. It's probably easier to just add a depth limitation though. Saving each map can take up a lot of RAM, and Rush Hour hasn't doesn't take up that many moves to win. a 100-move limit is very reasonable.
Posted: Sat Dec 15, 2012 7:45 pm Post subject: RE:Rush Hour Project
ahhh yeaa considering the most advanced rush hour game only has 93 moves, i should make a limit to 93, thanks
Posted: Sat Dec 15, 2012 9:01 pm Post subject: RE:Rush Hour Project
by the way, how can you keep a certain car from not moving backwards and forwards until the limit and then restarting over and over again infinitely, is there a way to stop this? also is there a good way to save an incorrect solution in a type of variable to not repeat it again
Posted: Sun Dec 16, 2012 4:54 pm Post subject: RE:Rush Hour Project
is there any function that saves previous moves that are proved to not help a solution, so the program does not loop over these moves infinitely?
Posted: Sun Dec 16, 2012 5:18 pm Post subject: RE:Rush Hour Project