A tcp/multiplayer implementation. The game is basically your everyday gomoku (or five-in-a-row), plus a capture two rule: if two stones (not more) are "clamped" by an opponents stone on both sides, they can be captured (see diagram below). Capturing 10 stones is an other way to win, besides placing five in a row. Stones are only captured when a clamping stone is placed - playing inside isn't suicide. The board edge cannot be used instead of a clamping stone.
This is a console java program that also acts as a telnet server; one player plays on the local terminal, another connects by a telnet client (preferably with local echo turned on). Board parameters are specified on the command line (the board is square and an odd number of intersections wide, between 7 and 19; optionally, it wraps around the edges), like this:
$ java -jar gobang.jar <boardsize>[w] [serverport]
For example
$ java -jar gobang.jar 9w
Default server port is 1200. When a client connects, the first match starts immediately. A board like this will appear:
A B C D E F G 1 . . . . . . . 1 2 . . . . . . . 2 3 . . . . . . . 3 4 . . . + . . . 4 5 . . . . . . . 5 6 . . . . . . . 6 7 . . . . . . . 7 A B C D E F G
Moves are played by inputting the column and the row (e.g.
d4
or b3
). Additionally, the following commands
can be used:
info
displays overall/match scoresresign
resign (in match only)!
reprints the board (in match only)ready
indicate readiness for new match (both players need to
write this after last match ended to begin a new match)?
prints command helpbye
disconnects, ends the game.
(period) to talk to your opponent.
Downloads: