-----Original Message-----
On HW2.5, I do need some clarification on the rules of this game: First, are there 5 pieces total, 4 robots plus 1 astronaut? Then, are the robots designated O, G, P. and Y? Then, are the only initial moves EITHER A moves North (up the board), or O moves South (down the board). After which, A, G, P, and Y all have "legal" moves by moving up to any other piece, north, south, east, or west, to a position blocked by another. However, O always remains at the position from its first move. A's mission is to get to the "Docking Port" (2,2) within the least number of steps, or any number of steps? How do the 40 cards fit into this homework question? Instead don't the 8 data sets identify the initial positions we're to focus on? Is this a correct interpretation of the game rules? Thanks. ------ Reply: There is always 1 astronaut, there may be either 4 or 5 robots. By convention the astronaut is indicated with the letter 'A'; any other letter indicates a robot. The letters are completely arbitrary. The initial move can be any legal move (if there are any) with either a robot or the astronaut. I don't see any reason why O would _always_ stay at the same position after its first move. Anything movable may move. A's mission is to get to the docking port in the least number of steps. The algorithm given in the problem (Breadth-First Search) will produce a solution that has the least number of steps (if there is a solution). Btw, the pseudo-code contains a tiny bug: if the start position already _is_ the solution, then it will not detect that... Also, it may be more convenient to only have one Board class, instead of a Board class and a separate Position class. The pseudo-code doesn't spell out how to get the path from starting position to final position. The easiest way to do this is to add a member variable Board parent to class Board, and then when generating children (=next moves), initialize it. That way, if you find a solution, you can trace back those parent pointers to the starting position. You should turn in solutions to the 8 given data sets. A solution should contain the path (=moves) from starting position to final position, or it should tell that there is no solution. The 40 cards are there for your further entertainment. Before even thinking of starting to write down code, I strongly advise everyone to play the online game first. Hans
