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

CodeCup 2019 - An online programming competition



The game Flippo is an variant of the game Reversi. It is played on an 8x8 square board. The starting position is showed in the image below.

Start position of the game Flippo

Each player has 30 pieces. Each piece is white on one side and black on the other side. Players take turns placing a piece on the board with their own color showing on top. The game ends when all pieces have been placed on the board.

Game play

The white player starts. Both players alternate placing a piece on the board. The game is finished after a total of 60 turns when the board is full. All pieces on the board must be connected (horizontally, vertically, diagonally).

After a piece is placed, all pieces that are on any line segment starting from the new piece, in one of the 8 cardinal or diagonal directions, and are between this piece and the farthest piece of the same color, with no empty positions between it, are flipped over to show their alternate colour.

If possible, a player must make a move that causes at least one piece to flip over. If no such move exists the player may place his piece anywhere, as long as it touches at least one other piece on the board orthogonally or diagonally.


In the following example black places his piece on B5.

The board before the sample moveThe board after the sample move

The second image shows which pieces have been flipped over by placing this new piece.


When the board is full, pieces of each colour are counted. Each player receives a score that is equal to the number of pieces with their colour minus 2. So if the number of white pieces on the board is W, and the number of black pieces is B, the white player receives W - 2 points, and the black player receives B - 2 points. The total number of points this way is always 60.


For the competition each player plays each other player exactly twice, once as the white player, once as the black 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. Play is resumed by a player that is controlled by the jury so your opponent can still score points. See the technical rules for more information about this.


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 white, the first line you will read is “Start”, your program must then output its first move. After this your program must read the move of the other player and continue responding with its own move until it receives “Quit” as input. If the first line your program reads is a board position this is the first move of your opponent. You now know that you are playing as black, so you must be writing moves to standard out. 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 “A3” would place a piece of your colour on the board in position A3.