This is the archived CodeCup 2024 website. Click here to go to the new CodeCup website. |

## IntroductionThis 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 gameThe 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.
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 " ## ScoringThe 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: - If your program exits during the game too early, or crashes, you lose with 0-2 instantly. The referee will not overtake your program this year.
- If your program exceeds the time limit, you will lose with 1-2 instead.
- If your move cannot be parsed, you place a digit on an occupied cell, or you place a digit in a row, column or box, that already contains this digit, you lose 0-2.
- If you claim the sudoku is unique with a “!”, and this is indeed the case, you win 2-1. If it’s not the case, you lose 0-2 instead.
- If your move causes the sudoku to be impossible to solve, you lose 1-2.
- If your move does not decrease the number of solutions, you lose 1-2.
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. ## Input/outputA 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
## CompetitionFor 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. |