This year we have chosen the puzzle sudoku as the CodeCup game for 2024. We follow the original rules for sudoku: you must end up with nine different digits (from 1 to 9) in all rows, columns and boxes. This two player game starts with an empty 9x9 grid, and you take turns placing one digit in a valid cell. The first player that believes the sudoku has a unique solution, claims the victory and wins the game.
Goal of the game
The challenge for this game is to claim that the sudoku — you both work with — has a unique solution, before your opponent does. If you overlooked that the sudoku has exactly one solution after your move, the chances are high that your opponent will claim uniqueness immediately in his next turn.
It turns out that not each obvious move can be played: the sudoku could have no solutions left after a move. If you make a move that makes the sudoku impossible to solve, you will lose immediately. The player claiming uniqueness successfully, wins. If you claim uniqueness but the sudoku has at least two distinct solutions, you will lose as well.
Additional rule: decrease number of solutions
Consider the following example:
In the example above you may not play in the bottom-left cell. This cell sees the digits 1,2,3,6,8 and 9. If you play any of these digits there will be identical digits in either the box or row, so you lose the game 0-2 (See scoring). If you play a 4 or 5 in this cell then the digits 1,2,3 and 7 must be placed in the three cells at the top of the box. Therefore these also leave no solutions, but since it is not immediately obvious, you lose 1-2 instead of 0-2. The only remaining candidate is a 7. Therefore all solutions have a 7 in this cell. If you play a 7, you lose the game 1-2 since the number of solutions did not strictly decrease.
Making a move
The rows are numbered from A to I, the columns from a to i.
For example, the move "
The scoring for this CodeCup game is a bit different than normal, because it is more challenging to find a valid move to play with this game. It’s possible that you run out of time while finding a move, because you are checking whether the sudoku still has a solution left. Otherwise, if you do not perform this check, you may provide an illegal move. In these two cases, we will be kind to your program. The following scorings are possible:
When your program is disqualified in a game (e.g. playing an illegal move), it will not be overtaken by the checker or referee, and that game finishes then immediately. Note: a draw is not possible.
When you play an invalid move that is hard to check or you run out of time, we are kind to you and award you still a point. However, if the move was illegal but easy to check, we will not have mercy.
A communication protocol has been designed for your program to communicate with the judging software.
The player that first reads "Start" from standard input must write his/her first move to standard output. If the player reads a move instead, he/she must write the second move to standard output. Do not forget to flush!
A player that reads "Quit" on standard input, must terminate his program.
Players can write information to standard error during execution, which can be read by you after the game is played. For more information, see the Technical rules.
Example communication of a normal game
For the competition each player plays each other player exactly twice, once as First and once as Second. The overall winner of the competition is the player with the highest number of points overall. For more information, see the Competition rules.