CodeCup 2025 - An online programming competition  

CodeCup 2025 - An online programming competition

Introduction

Box is a board game designed by Chris Handy. See: https://www.perplext.com/packogame/box. In the CodeCup it is played by two players on a 20x16 board on which 6x2 tiles must be placed in turn. The tiles contain dots in 6 different colors. Each player is assigned a secret color. The aim of the game is to form squares of your own color, as shown in Figure 1. Player 2 scored in turn 16 +6 points forming square Fd-Fj-Ld-Lj. His secret color is yellow (color 2).

Tiles

Each time it is a player's turn, he receives a randomly generated tile. The top row of the tile contains 6 dots of different colors in random order. The bottom row is the same as the top row, but just in reverse order.

Moves

The player must place the tile on the board. There may be an overlap of a maximum of 4 dots. If a dot is placed on top of an already placed dot, it will 'override' the color to the new one. If there is no overlap, the tile must connect somewhere adjacent with the tiles already placed. At least one of the dots of the placed tile must be next to another dot of the group of tiles, horizontally or vertically.

Rules

Both players first receive their secret color and the starting tile, which is placed in the middle of the board, in Figure 2 the tile "Hh216534h": is placed on spot Hh. The order of the colors in this example is 216534 and is always placed horizontally. The last letter h indicates that the tile must be placed horizontally. A v indicates that it must be placed vertically.

The starting player then receives "Start" and a tile in the format "123456", on which the 6 colors are shuffled randomly. It is up to the player how to connect it to the existing tile. It has a total of 125 options to do this horizontally or vertically. In figure 2 the tile "Ik364521v" has been placed. Then the tile "462513" was given to the second player and he placed it as "If462513v". It continues that way, until there are no more moves possible.

If a player makes a mistake, crashes, leaves too early or runs out of time, he receives a "Quit" from the jury software and the jury takes over his turns. The jury software only plays randomly generated moves. When no more tiles can be placed, each player receives a "Quit" as input, and must terminate his program.

Protocol

Your program must follow the protocol when communicating with the judging software. Your player must read information from standard input, and output its move to standard output. For more information, see the Technical rules.

After reading their secret color and the starting tile, the player that first reads "Start" from standard input is Player 1, and they must write their first move (after reading the colors of the first tile) to standard output. If the player reads a move instead (e.g. Ik364521v), they must write the second move to standard output. Do not forget to flush your output!

Player 1Player 2
InputOutputInputOutput
3
Hh216534h
Start
364521Ikv
2
Hh216534h
Ik364521v
462513Ifv
If462513v
326451Fch
Fc326451h314625
etc.etc.etc.etc.
Quit
Quit

In this example, Player 1 plays with color 3 and Player 2 with color 2.

Getting points

Each orthogonally shaped square of your own color is worth points. A 2x2 square is worth 1 point, an nxn square is worth n-1 points. The maximum score for a 16x16 square is 15 points. Only the squares that are still visible and intact at the end of the game will count, so you can undo points for your opponent by placing a tile on top of others.

You win if you score more points than your opponent. The winner receives 200 points plus the difference in scored points. The loser gets 100 points minus the difference. In the event of a tie, both players receive 150 points. If the difference is greater than 100 points, the loser receives no points. On the contrary, in that case the winner receives more than 300 points.

Competition

For the competition each player plays each other player exactly 10 times, 5 times as Player 1 and 5 times as Player 2. The overall winner of the competition is the player with the highest number of points overall. For more information, see the Competition rules.