Project 6: Solution Jogo Da Velha

See the assignment for a description of the project.

Her is a partial solution, the code broken down according to subclass:

Test routines

Usage:

The JogoProtoTestLocal prompts you to be either server or client, and you must simulate the other half of the protocol by typing responses at the keyboard, as well as exercising calls on the JogoProto interface.

The JogoProtoTestNet is as a server (-s option) and then is connected to using client mode (no -s option, instead a hostname). You drive the JogoProto interfaces and get to see the letters on the wire.

Todo:

  1. When client continues to request new games, multiple "waiting for response..." messages appear at the server.
  2. To quit, ^C and wonder at the ProtocolException messages. Needs to be cleaned up.
  3. Doesn''t detect end of game.
  4. Make select abstract in JogoProto base class and implement for *Server as throw new ProtocolException().
  5. Alex noticed that a simpler protocol is comprised alternating messages of the single character 0,1,...,9. Any number is valid at any time. 0 signals start of new game, fiat by sender. Receiver can then go first or pass first move back to sender according to whether its chosen response is 0 or another digit.