Command line application for managing Google Code Jam contest submission based on the googlecodejam-client API.
Please note that this client is not provided by Google. Any responsability is declined if a bug occurs when you are using it in a real contest condition. This API is fully working in a practice context, but has never been tested in a real contest.
This command line application consists in the client JAR and a running script is also available. Here is the usage description :
codejam action parameterWhere action belongs to the following option list :
- --init
- --download
- --submit
Please note that Firefox web browser is also required.
You can install script and packaged version of client by running the following command :
wget -O - https://raw.githubusercontent.com/Faylixe/googlecodejam-cli/master/scripts/install | bashOnce script has been executed, you can run the codejam command. Please note that installation script should be ran under root permission.
If you are not comfortable with running script from an unknown source with root permission, you can just download the last released jar file, and run it using the command :
java -jar googlecodejam-cli.jar action parametersThis action is in charge of retrieving a SACSID cookie value which is mandatory for querying Code Jam platform successfully. This cookie can be either retrieved using :
- Firefox browser
- Raw cookie input
By default the Firefox method is used, which will open up a Firefox instance in order to authenticate to Google services. Once Firefox is opened and the login page loaded, please proceed to the authentication process, and when you will be logged and redirected to the code jam home page, Firefox will be closed automatically.
codejam --initIf you want to directly supply the SACSID cookie value you can use the --method parameter :
codejam --init --method textOnce logged you will be prompted to choose a contest and a round. Those will become contextual round and session for the current directory you are running the script in, meaning that if you run another time the script with another action, it will use the created contextual logged session and round.
As it name suggests, the download action allows logged user to download an input file for a given problem. If the contest is active, then it will trigger the submission timer depending of the input difficulty you have choosen (usually 4 minutes for a small input, 8 for a large one).
The following exemple will download the small input file for the first problem.
codejam --download --problem A --inputtype smallIf the download is successful, the name of the downloaded file will be printed, so it could be chained in a command workflow, for example :
cat < `codejam --download --problem A --inputtype small` | python A.pyOnce input file is downloaded, and algorithm solved all test cases, submit action could be used in order to send either the output file as the source file of your algorithm as well.
codejam --submit --problem A --inputtype small --output path/to/output --sourcefile path/to/sourcefileWant more than a command line application ? Take a look at the Jammy project, which provides a dedicated development perspective in Eclipse IDE.