A long time ago text-only adventure games were very popular (especially those written by Infocom). In these games a player would move around a maze by issuing commands such as "north" or "west", and would be told what he saw. Of course, those games were all implemented so as to run on a single machine.
For this problem set you will implement a very simple
adventure game. The "game" (if we can call it that) consists of
a 10 by 10 grid. There are a number of players that
can inhabit this this world. You will need to implement a
maze class which holds references to all the
players and keeps track of their position.
Unlike in the old adventure games, this game is real time, so it
does not pause to wait for input from anyone. The clock ticks
once every five seconds. After every tick the
all players for their move, which can be either a move north,
east, west, or south. The
maze makes sure that
nobody can leave the maze. After it has received all moves, it
executes them and then tells all players what they see. The
players see all the other players that are in their
square. There can be any number of players in a square.
You will implement three types of player:
humanplayer asks the user what move he wants to take, and also displays on the screen what the user sees.
boxplayer is initiated in some position and does nothing
robotplayer moves randomly on each clock tick.
The most important part of this problem set is that both the
maze and all the players must be distributed with
RMI. That is, it should be possible to run every player and the
maze on a different machine. Also, new players should be able to
join an ongoing game.
Output: So that we can see what is going on, your
maze should print out each step number and the
locations of all the players. Meanwhile the
should print out what it sees on each step.
Handing it in:You will follow the same procedure as for PS1, using the same template README file. However, since the ability to start an RMI system is part of what you must learn from this PS, this time the instructions in the README will be graded. Specifically, your instructions must detail how to start one maze object, one human, one box, and one robot, with the maze running in one machine (A), the human in another (B), and the box and robot on a third (C). Remember, however, that your implementation must not rely on this particular object distribution.