|This is the archived CodeCup 2011 website.
Click here to go to the new CodeCup website.
Dvonn, the game
Dvonn is a two player game that is played on a hexagonal board. One player plays using white pieces; the other player using black pieces. Gameplay is split up into two distinct phases. In the first phase the players place their pieces on the board; in the second phase the players move their pieces.
The object of the game is to end up with more pieces than your opponent by the end of the game.
Board and pieces
The board consists of 49 hexagons. The layout is 5 hexagons wide. The picture below shows the layout of the board.
Each player has 23 pieces; one player plays with the white pieces, the other player plays with the black pieces. There are also 3 red neutral pieces; these are called Dvonn pieces.
First Phase (Placement)
The game starts with an empty board. During the first phase the players place their pieces on the board, starting with the three red Dvonn pieces. Pieces can be placed on any unoccupied space. White starts, and the players alternate placing a piece. This means that Black is the first to place a piece of his own colour. When all pieces have been placed the board is full. The last move piece placed is a white piece.
Second Phase (Movement)
During this phase players try to build stacks of pieces. The smallest stack is a stack of a single piece; there is no limit to the size of the stack. Players build stacks by moving one stack on top of another stack. A stack is controlled by a player if his colour is on top. A stack that is surrounded by six other stacks cannot be moved; it is called immobile. Once again the white player starts.
Any mobile stack of height N (with N > 0) can be moved in a straight line in any one of six directions on exactly N hexagons provided that it lands on another stack. Note that a stack can only be moved by the player that controls it. A stack can jump across empty hexagons. A stack that consists only of a single Dvonn piece is not controlled by a player.
After each move all stacks that are not connected via a chain of other stacks to at least one stack with a Dvonn piece in it are removed from the board.
Passing and game end
A player that has no legal move must pass.
A player may only pass if he has no legal move to make.
The game ends when there are no legal moves left for both players.
At the end of the game the players count how many pieces they control; i.e. how many pieces are in the stacks that they control.
The player with the most pieces under control wins.
If both players have the same number of pieces the game ends in a draw.
Both players get a score that is equal to the total number of pieces under control. The winner of the games gets another 90 bonus points. In case of a tie both players get 45 bonus points.
If a players makes an illegal move, crashes or runs out of time, the opponent wins automatically. The players that causes the illegal game gets a score of 0. The jury software will take control of the problematic player. The jury software will search for legals moves and will make the first legal move. This enables the remaining player to still score points.
Playing the game
Your program communicates with the jury program using standard input (stdin) and standard output (stdout). Your program reads information from stdin and writes its moves to stdout.
The player that starts the game (white) will receive the word Start on stdin when the program is started. The player that plays black receives the first move of white on stdin when the program is started.
Your program should determine a move and write the move to stdout. After making a move your program should read the move of the opponent from stdin. Any move that you read from stdin is guaranteed by the judging software to be a legal move. Note that all moves will be terminated with a newline and you must flush your output.
The last move in the first phase does not give white a choice. White must move into the last available place and immediately move again for his first moving of a stack.
If a player must pass the player writes PASS.
The program should continue until the text Quit is read on stdin. This indicates that your program has to terminate normally.
Your program has a total playing time of 5 seconds. The jury computers use a Pentium IV, 2.8 GHz with 64 Mb of internal memory available for your program. You can decide how you divide the 5 seconds over the various moves. Your program is suspended after the system receives your output and turned to an active state when there is input for your program, only the active time is counted.
CodeCup is a computer programming competition that is organized the Nederlandse Informatica Olympiade (NIO), the Dutch Olympiad in Informatics. The competition is hosted online and can be followed live on the internet. Programmers from all over the world can enter the CodeCup competition. CodeCup staff and NIO staff do not participate.
Click here to see a sample game.
For more information on tactics have a look at http://en.wikipedia.org/wiki/DVONN.