Network Tick-Tack-Toe

Assigned homework 24 January 2003.

Goal

Write a tick-tack-toe program that can be played across the network, using the client-server paradigm, in Java (C/C++ also permitted).

Step-by-step

  1. The Chat
    You have been given examples of Java network programming which should allow you to create a client-server chat program: two applications which allow you to type back and forth across the the network. (See Java by Example handout.) Your first step is to get these working.
  2. The Protocol
    We need to define the messages which will be sent between client and server. This is a very important step, and we need to be very accurate. There are four messages. Get this protocol working after the chat is working. It consists of loops on the server and client code which interpret the messages and make reasonable responses. In particular, don't worry too much about correct game boards, rather that the rules of message interchange are followed.
  3. Playing the Game
    Now add the application layer software which presents the board to the user pictorially, offers opportunities to move, resign or quit. Also the application layer can check new and old boards for correct play and check if the game has been won. If the game is won it can prompt the user whether it wants a new game, whether it wants to go first, or whether it would rather quit. Do this layer last. It is the least tricky and you can spend endless hours making the interface handsome, friendly and flexible.