Game System Backbone

In this project you will write the back-end of a system to support turn-based AI tournaments. You are provided with the complete documentation for the system, and the implementation of several classes:

You will have to write the following:

Requirements

  1. Your implementation should fully conform with the Javadoc documentation given.
  2. In GameProxy, makeMove should determine if the move was made within the window of opportunity, and immediately return, so the Player object regains control of the thread quickly.
  3. In GameProxy, moveAvailable should also return right away. Use an interrupt() call to wake up a Thread who's sole responsibility is to call moveAvailable on the Player object. That thread should just be looping in the run method of GameProxy, alternately waiting to be interrupted and calling moveAvailable on the Player. If the player causes an exception on that thread, you can just let that thread crash; the game should continue on regardless.
  4. If a player doesn't report a move by the deadline for that move, that move is forfeited (the call to GameServer has null for the move). Once the player object returns from moveAvailable, the most recent move is made available by GameProxy calling moveAvailable on the Player object again. For example, if a player took too long thinking and missed a few turns, only the most recent turn is made available with a call to the player's moveAvailable method.
  5. There should be no possibility of race conditions or deadlocks. Be aware: suppose that an RMI call is made from GameProxy to GameServer, which in turn makes an RMI call back to the GameProxy. Note that the thread created from the second RMI call will be a different thread than the one that originally made a call to GameServer. Therefore, there is a possibility of deadlock between the two, since that lock is then effectively not reentrant (it would be reentrant if RMI wasn't involved).
  6. GameProxy should not hog CPU cycles away from player by busy waiting. If you need to put pauses in, sleep the thread. It is perfectly acceptable to have a short pause (say .1 seconds) between the time the deadline passes for the player's move, and when that move is reported to the GameServer.
  7. GameProxy should call the GameServer exactly once per turn.

Due November 12, at the start of class.