This is the archived CodeCup 2024 website. Click here to go to the new CodeCup website. |
Technical rulesThis section explains how you should write your program. Since the competition is automatically controlled by scripts, it is important that your program works exactly according to these rules. Sending your program
To enter the contest, you must write a program that is able to play Sudoku.
You must submit the source code of your program on this website.
The source code must consist of one single file.
The maximum allowed size of the source file is Input and outputYour program reads input from standard input (normally "the keyboard") and writes output to standard output (normally "the screen"). Your program is started once at the beginning of a game and keeps running until the end of the game. You should strictly follow the dialogue described in the game rules. Each element of input or output is on a line by itself. You may assume that all input to your program is completely correct. Note: when you write a move to standard output, make sure to flush the stream, so the referee is not waiting for the move. Below is explained how you can flush in some of the supported programming language. For debugging, your program may write messages to standard error. Those mesages will become available to you, and only you, on the game result page. However there is a limit to the amount of characters that will be logged (approximately 10 000 characters), so you need to use it sparingly. Programming languagesYou may write your program in C/C++, Python, Java, Pascal, JavaScript, Haskell, OCaml, Go or Rust. The table below shows which compiler and configuration we are using.
C and C++Programs written in C or C++ are compiled with GCC, and linked with the standard math library.
You can use
In C++ it is also possible to use PythonPrograms written in Python are run with the Python interpreter.
You can use
You can use all standard Python modules (e.g. Note that Python programs are typically slower than programs in C, Pascal or Java. JavaPrograms written in Java are compiled and run with OpenJDK.
You can use the object
It is possible to make more than one class for your program, but you will have to put the source for all classes in a single .java file (the compiler will produce multiple .class files anyway).
When you do this, you should not declare your classes
When submitting your Java program on the website, don't forget to enter the exact name of the main class of your program (the class which contains the PascalPrograms written in Pascal are compiled with FreePascal in TurboPascal mode.
FreePascal is a lot like Turbo Pascal, but it is more powerful.
You can make an array of a few megabytes size without problems.
Please note that the types
You can use Using units in your program is not recommended. They will not help you very much and may cause problems when your program runs in the competition system. It is not possible to use units you have written yourself, since your source code must consist of a single file. Especially the CRT unit will cause problems. Do not use the CRT unit. JavaScriptPrograms in JavaScript are run with the V8 JavaScript engine.
You can use
Runtime environment
Your program is allowed to use at most 30 seconds per game. We measure only the time that your own program spends to select a move, not the time that your opponent spends to select a move. If your program exceeds the time limit, it loses the game and receives a penalty for irregular loss of a game. There is no time limit per move, only the time limit per game. So your program could use 29 seconds for the first move, but then it would have to do the rest of the game in 1 second. Remember that the CodeCup systems are 2.00GHz. If your computer at home is slower or faster, you will have to be careful. It is always a good thing to play a game at home exactly as it was played on the CodeCup system. You can see how much time had been used by your program. To keep the contest fair, some things are not allowed:
|