This is the archived CodeCup 2022 website. Click here to go to the new CodeCup website. |
IntroductionSpaghetti is a two player board game created by Jelmer Firet in cooperation with the CodeCup team. Spaghetti was inspired by the game Black path game which was analysed in the Dutch mathematics magazine Pythagoras, intended for high school students. Board
Spaghetti is played on a Figure 1: a possible initial board The blue and red player alternate turns, and blue starts. During a turn, a player places one tile in an empty spot on the board. There are three tiles available: Figure 2:
the available tiles: left ( ScoringEach player starts with 50 points.
When a player creates a cycle by placing their tile, that player loses When a player creates a path that goes from the left wall to the left wall, they lose 3 points.
The player also loses 3 when they create a path from the right wall to the right wall.
When the blue player creates a path from the left wall to the right wall, it receives points equal to the number of segments from the last placed tile to the left wall. For the red player, one needs to count the number of segments from the last placed tile to the right wall. In the event that this path contains both segments of the placed tile, you must count the number of segments from the segment that is the farthest away from the wall. See Figure 3 for an example.
Figure 3: When blue played Because a tile has two segments, placing a tile may complete two paths. If these two paths are different, the scoring rules are applied to each of the paths separately. Of course, if the paths are the same, the scoring rule is applied only once. In the visualisation, tiles are initially placed with segments coloured black. When a path is connected with an endpoint to the top or bottom wall, it gets a grey colour since it can not affect the score. A light colour indicates that the player lost points because it created a cycle or connected the wall to itself. When a segment is blue, it was counted as a point for blue, and it is red if red received a point for this segment. Input/OutputA communication protocol has been designed for your program to communicate with the judging software.
Your program will first read two moves done by the jury each on a separate line.
A move is specified by a string of three lowercase letters: the first letter is the row, the second is the column and the last character is the code for a tile as mentioned in Figure 2.
In Figure 1, the two jury moves are
If your player is blue, the next line will be “Start” and your program must then output their first move. 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. If your program reads a move instead of “Start”, this is the first move of your opponent and you play as red. 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. For more on I/O, see the technical rules. Example communication of a normal game
CompetitionFor the competition each player plays each other player exactly twice, once as the blue player and once as the red 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 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. |