CP2003 - Tutorial Ten: Net-TicTacToe
Today we're going to look at extending an existing application with a
network interface.
- Firstly, consider the example TicTacToe.java.
- Download, compile and run TicTacToe.java (don't forget to download the
images nought and cross to the
same directory).
- Once you've had enough of being thrashed by the computer, try
implementing a network setup of tictactoe:
- The client should contain all the graphics-related code;
- The server should keep track of what moves are being made (you'll need
to pass the location of the mouse clicks to the server so it can track the
progress) and who wins;
- The server should also perform the computers moves and sends these
moves back to the client;
- The client receives the computers moves and updates the display
accordingly.
- Take a look at
SocketReader.java and
SocketWriter.java for an example
of how to approach client/server programming.
- If you manage to make it this far, how about trying to create a client
vs client system where two remote human-controlled clients can face off
against one another.
Copyright © 2000. James Cook University. All rights reserved.