CodeCup 2018 - An online programming competition  

CodeCup 2018 - An online programming competition

The Rules of Symple

Symple is a turn based game where two players compete against each other by placing stones on a 15 x 15 board. Players get points for each stone of their colour on the board; they lose points for the stones being in different groups.

Definitions

The board consists of a grid of 15 x 15 lines. These lines create 225 individual intersections called points. Initially all points are vacant.

Orthogonally connected stones of one colour form a group.

A single stone that is not connected to any other stones is a group by definition.

Players

The game is played by two players, White and Black.

White moves first.

When it is a player's turn a move has to be made.

Moves

Each turn a player must choose which move to make. There are two types of moves:

expansion                 place stones in vacant point so that the size of all different groups at the beginning of the turn increases by at most one. If a stone is placed that connects several groups, all connected groups are considered to have grown by one stone.
exploration                 place a single stone on the board in a vacant point that is not orthogonally connected to another square, thereby creating a new group.

Note that if a player choses an expansion move, he must place his stones so that at the end of his move there are no points where another stone could be placed without breaking the expansion rule.

Balance of power

In order to compensate for any advantage to White for playing first Black has a special move. If no player has expanded yet, Black has the option of expansion followed by exploration in the same turn. Obviously this move can be used at most once during a game.

Examples

The following images show several situations that may occur during a turn.

Black expands into E4. The group B2C2 must still be expanded. This group cannot be expanded into C3.
Black expands B3C3 with D3. The group E2F2 can be expanded into D2 or E3. Even though these touch D3, this move does not expand the other group as it was at the beginning of the turn.
White expands into C3. All groups are considered to have grown by one stone. So no other expansions are allowed.
If white expands into D3 no expansion is allowed in C2. However, expanding the other group with C3 is still allowed.
If white expands into D1 the group A1 cannot be expanded into B1. This is still a legal move since at the end of the move no more groups can be expanded.

Object of the game

The game ends when the board is full.

The score of each player is determined by counting the number of stones he has placed on the board. For each separate group 6 points will be substracted. Note that at least 6 points will be substracted since the stones will always form at least one group.

The minimum score is 0; during this tournament only a negative score is converted into 0.

The player with the highest score gets 100 bonus points.

Illegal moves

If a player makes an illegal move, crashes, or runs out of time, this player gets a score of 0.

The jury software will take control of the problematic player and will finish the game for this player. The jury software will find all legal moves in an undisclosed yet deterministic way and will make the first legal move it finds. This method will allow the second player to score points.

If the second player also makes an illegal move later during the game this player also receives a score of 0.

Playing the game

You have to write a computer program to play the game. Your program will never communicate directly with your opponent; instead you communicate with the jury program using standard input (stdin) and standard output (stdout).

Your program should read information from the jury program from stdin and write your moves to stdout.

Your program must begin by reading from stdin. The jury writes 'Start' on stdin for the White player. The Black player receives the first move of the White player on stdin. This means you have to determine yourself whether you are Black or White based on the first line that you read.

Your program determines a move and writes this 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. You must flush your output after each move.

The program must continue until the text 'Quit' is read on stdin. This indicates that your program has to terminate normally. In the case that no more input is expected, your program may quit by itself.

Example Game

The following table describes a sample game. For each consecutive move the table shows what a player had read on stdin, and what was written to stdout.

WhiteBlack
MoveInputOutputInputOutput
1StartM13
2M13M10
3M10D12
4D12M11-C11
5M11-C11J12
6J12G3
7etc..

Time limit

Your program has a total playing time of exactly 30 seconds for all moves combined. The jury computer uses an Intel Xeon E5405 running at 2.0 Ghz, with 64 MB memory available for your program. You can decide how to divide the 30 seconds over the various moves. Your program is suspended when the system receives your output and turned to an active state when there is input for your program. Only your active time is counted towards the timelimit.

About CodeCup

CodeCup is organized by 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.

More information

Click here to watch a sample game. For more information on tactics have a look at http://www.mindsports.nl/index.php/arena/symple/.