This is the archived CodeCup 2020 website.
Click here to go to the new CodeCup website.
CodeCup 2020 - An online programming competition  

CodeCup 2020 - An online programming competition

Gomoku

Introduction

Gomoku, also called Five in a Row, is an abstract strategy board game. It is traditionally played with Go pieces (black and white stones) on a square board, using 16×16 grid intersections. Players alternate turns placing a stone of their color on an empty intersection. The winner is the first player to form an unbroken chain of five stones horizontally, vertically, or diagonally.

The black player starts by playing the first three moves, first a black stone, then a white stone and finally again a black stone. Then, it is up to the white player to accept this starting position or not. If so, the game continues until one of the players has achieved five stones in a row. If not, the stones are replaced by stones of the opposite colour and the black player continues until one of the players has achieved five stones in a row. The refusal counts as a move, indicated as “Zz”.

Final position in a game of Gomoku

In the picture a final position of a game is shown. The white player has won with five in a row in row J.

Score

When none of the players could win, the game ends in a draw with a final score of 50 – 50. A wining player gets a score of 101 – floor(number/5) points. The losing player gets the remaining floor(number/5) - 1 points. In these calculations number is the number of moves that was played.

Input/output

A communication protocol has been designed for your program to communicate with the judging software. You will read the moves of the other players from stdin (standard in). You must print your own moves to stdout (standard out). You are free to write to standard error (stderr), which you can read after the game has been played and you have been logged in on the website, with a maximum of 10000 characters per game. If your player is black, the first line you will read is “Start”, your program must then output the first three moves. After this your program must read the move of the other player and must continue responding with his own move until it receives “Quit” as input. If your program in the first line reads a board position, then this is the first move of your opponent. Now you know that you are playing as white. First you must read the next two moves from black and then you must write your own move to standard out and so on. When the board is full you will receive one final “Quit” instruction. If your program makes an illegal move you will be sent a “Quit” instruction as well. This should allow you to send debugging information to standard error. Each move will indicate exactly one position on board. The move “Hj” would place a stone of your colour on the board in position Hj.

Competition

For the competition each player plays each other player exactly twice, once as the black player, once as the white player. The overall winner of the competition is the player with the highest number of points overall. If your program exceeds the time limit, crashes or makes an illegal move, your program will receive zero points. The play is resumed using a player, controlled by the jury, that randomly plays moves so that your opponent can still score points. See the technical rules for more information about this.

For more information about this game, see Wikipedia.