Posted by: zeroratio | October 5, 2008

Connect 5: high level specification

User interface:

  • Representation of the game board has to be clickable graphics

Game play:

  • Person-2-person mode supports communication of two instances of the program over the Web
  • Person-2-computer mode: human player against computer AI, which can be loaded by selecting it from a list of avaiable AIs from a drop-down menu.
  • Computer-2-computer mode

Game rule variants:

  • Regular connect 5: each player takes turn placing a piece on the game board, alternating between black and white pieces. Who connects 5 pieces in a line (horizontal, vertical, or diagonal) first wins.
  • Memory Connect 5: each piece will disappear after a prespecified length of time (eg. 2 secs). Placing pieces on an existing piece may cause a penalty (eg. lose a turn)
  • Japanese rule: if the first player makes a double-3, double-4, or longer-than-5 move, then s/he loses.
  • Speed: each move has to be played within a prespecified length of time, and when the player does not play a piece before time is up, s/he loses the turn

The 2 most challenging implementations are the networking package and the clickable GUI. If we break down this project into components, these two can be developed and tested quite independently:

  • Networking: use the console as output, send information between two instances of the program. The game board can be printed to the console each time a move is played. No rule-checking required.
  • GUI: create a game board with 19 x 19 lines. Every intersection of these lines can be clicked on, and a round piece will appear on the intersection clicked.

Other components of this project include: game control and game rules.

  • Game control: the game can be played by either a human player or an AI agent. Use polymorphism (interface) here.
  • Game rules: the game can have many different rules, not even limited to Connect 5. For example, Go can be played with just a change of game rule. Use polymorphism here again.

And somewhere down the road, AI agents can actually be created. But this is still a distant aspiration, and should not be attempted until the above infrastructure is in place.

Posted by: zeroratio | April 5, 2008

On my project list: Memory Connect 5 (Gomoku)

After timetablebuilder.com, I have a few project ideas lined up. One of them was inspired by my little bro, who invented “Memory Connect 5″ with his friends (yes, from Sci One). Basically, it’s Connect 5 with a twist: players don’t see the game board.

gomoku.pngTraditional Gomoku

Instead, a moderator keeps track of where the players placed their pieces, and informs the players when they make invalid moves.

The way my bro plays it, is the players take turn calling out coordinates. As you can imagine, things get really fun after 10 moves or so.

As an addicted programmer who is also crazy over Connect 5, I offered to write a program for my bro (and then beat him in his own game!).

Maybe I will also write an AI in case my bro decides he’s too cool to play games with me. In which case I will have an even greater satisfaction if my AI beats him XD

Here’s a cool dude’s site on Connect 5 AI, with a horrendous but generously shared source code. His AI is ok; I beat it on 2nd try. But this source code would help me a long way in my own development, since I have very limited or non-existent experience in AI, networking, or even graphics…

Much cleaner code can be found here.

But TTB first!

Categories