Thursday, October 12, 2006

M254 - Tic-Tac-Toe

Well, long overdue for an update. And the reason for my silence, I hear you wondering, is that I had my head burried deep in TMA04 for M254. The task given was to create a client/server system that could be used for playing board games. Specifically, we were asked to write one for playing "Noughts and Crosses" (or "Tic-Tac-Toe" if you're American, which I'm not). There was no game logic required because this wasn't a case of man versus machine (at least, not in the game playing sence - although it felt like it times in the programming sence!). All that was required was that a game-server would be able to manage concurrent games being played by pairs of players who were connect over TCP from their client machines. The server would have to maintain the state of the each game, announce whose turn it was, and advise of interesting situations - like winning or drawing. The client side code had to create a game interface and send messages to, and receive messages from, the server.

Nothing too challenging or strenuous really. Once the server was working for managing a single game between two players, it had to be extended to handle multiple concurrent games - ie by using threads.

Good news - I wrote it all in time - and it worked. Not perfect code - even I could see that but a score of 89%, although my lowest of the course, is still satisfactory and means that, depending on how I do in the exam (!), I could still get a Distinction for this course.

We'll see.

No comments:

Blog Watch