CodeCup 2023 - An online programming competition  

CodeCup 2023 - An online programming competition


Entropy is an abstract strategy board game for two players designed by Eric Solomon in 1977. The game is based on the eternal conflict in the universe between order and chaos. One player is Order, the other Chaos. Order is trying to make patterns vertically and horizontally. Chaos is trying to prevent this.

The game originally employed a 5×5 gameboard, but in 2000 a 7×7 board was introduced to allow deeper strategies. So, in the CodeCup we play it on a 7×7 board.


The gameboard is a square grid of 7×7 cells. A match between two players consists of two games. Each game starts with the board empty, and a bag containing 49 chips in seven colours.  The first player to move (Chaos) draws coloured chips at random from the bag and places each one on the board in an empty cell. For each chip that is placed, the second player (Order) may slide any chip horizontally or vertically any distance through empty cells, to rest in a currently empty cell. When the board becomes full, the game is finished.

Order scores 1 point for each chip in any palindromic pattern of chip colours (e.g. red–green–blue–green–red scores 3 + 5 = 8 points; red–red–red scores 2 + 2 + 3 = 7 points) occurring either horizontally or vertically. The players reverse roles and play a second game. The player with the higher score is the better player.

Example of the calculation of points on a final board

example of point calculation
16 + 4 + 3x2 + 2x3 = 22
43 + 2x2 = 7
53 + 2 = 5
67 + 5 + 3x3 +4x2 = 29
15 + 3 = 8
23 + 2 = 5
42x3 = 6
73 + 2 = 5


In the CodeCup, two games are played each round for each player, one game as Chaos and one game as Order. Let S be the number of points Order has earned by making as many palindromic patterns as possible. If you are Chaos you will score 280 – S points, but if you run out of time, crash, play illegal or invalid moves you will get 0 points. If you are Order you can score 120 + S points. Also, if Order runs out of time, crashes or plays an illegal or invalid move, he also gets 0 points.

The numbers 120 and 280 consist of 200 points that is awarded if you do not make mistakes and the 80 points, we think, is close to the average score that is made in a common game.


A communication protocol has been designed for your program to communicate with the judging software.

If your player is Chaos, the first line you will read is "Start". Your program must first read the colour of the first chip and then must output the first move. An example of a move is Bc, the first letter is the row, the second is the column. The chips come in random order. If the first line you will read is something like 3Bc, then your player is Order. That means Chaos was given colour 3 and he placed it on spot Bc. The colours are numbered from 1 to 7. Then you must slide one of your chips vertically or horizontally, for the first chip you can do something like BcBg, although BcBc is also allowed. After this your program must read the move of the other player and must continue responding with their own move until they receive "Quit" as input.

Note that Chaos always reads the colour of the next chip before he can output the next move. When there are no moves left to play, 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.

Example communication of a normal game

Input Chaos Output Chaos Input Order Output Order


For the competition each player plays each other player exactly twice, once as Chaos and once as Order. 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 0 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.