Jacques Frechet's CS20c Project Progress Report:

Four-Dimensional Tic-Tac-Toe


What I Have So Far

I have an applet of sorts which demonstrates the basic user interface. Unfortunately, the part that detects a win is broken right now; I'll see if I can get that working again by the deadline.

The important thing, though, is that the applet implements the basic internal framework I'll be using. Perhaps you'd like to check out the source:

What Needs To Be Done

The next step will be to implement an efficient board-evaluation routine and replace the dummy makemove() method in class Computer with one that implements minimax/alpha-beta. Currently I'm working on an incremental board-evaluation algorithm which won't need to reexamine the entire board at each node in the game tree. I plan to do a simple, linear evaluation which examines every possible linear arrangement of four (or however many) spaces on the board, and assigns each one a score, then adds the scores together. The order of such an algorithm (incremental or not) seems to be O(n3), where n is the number of dimensions; the non-incremental version also depends linearly on the number of squares on the board, which is itself a degree-n polynomial, so I'd rather avoid that if I can.

If there's any time left once that's done, I'll go on to add a server for human-vs-human games. This will require the addition of a few new classes, such as a new Player subclass, and a class that handles the multiplexing of the client/server connection, at least for incoming messages from the server. Here's a quick summary of a little line-oriented stateless protocol I plan to use:

Messages the server can send:

Messages the client can send:

So, for instance, if the client thinks the server has sent it an illegal move, it can send "status," after which the server will respond with the appropriate "welcome," "player," and "game" messages. On the other hand, if the server thinks the client is doing something foolish, like playing out of turn or making an illegal move, it can make arbitary changes in the client's state by sending the appropriate "game" or other messages, perhaps accompanied by some explanatory "message" (such as "Name already in use" if the server is resending "hello" after an invalid "name" command).

The server won't really need to be very complex. All it needs to do is keep track of the state of each game, do some simple sanity checking, and send updates when appropriate.

Related Documents


Jacques Frechet