Er, ok, I guess I am. Well I suppose my problem is that I don't know how I could keep track of the moves that eventually lead to the solution when actually trying all the possible moves. I don't suppose a nudge in the right direction would be out of the question / morally unacceptable?
Thanks
User Profile
Collapse
-
First, let me say thank you for the response :) Though those aren't actually my problems.
From the starting code for the assignment, trays will be encoded into 2-d arrays of integers, where each value at a row/col will be either -1 for empty or the id of an instance of Block in the tray. Mea culpa for not mentioning that in the OP. There's already a possibleMoves method too, which returns a SortedSet of instances of the class Move....Leave a comment:
-
HashSet confusion
Hi all, I'm writing a program to solve sliding block puzzles like these and while I think I've more or less figured it out, I have one problem before I start coding it.
During execution, the program will take the possible moves that can be performed on an board position, perform them, and add the new boards to a HashSet if they aren't in there already until a board that satisifies a solution is found. The trouble is I've never used...
No activity results to display
Show More
Leave a comment: