codingame-connector
will help you to develop solutions for Codingame exercises
on your local computer. You don't need the browser to be open during your
development process (save your RAM!).
First, you need NodeJS installed on your machine. If you don't, you can take a look to the nvm project which allow you to install Node without root access.
You can simply install the cg-watch
command with the following command.
npm install -g codingame-connector
Then you can use it from any folder with cg-watch
(see for configuration
below).
To install codingame-connector
, you can clone the project. Then you'll have
to install the Node modules.
git clone https://github.com/woshilapin/codingame-connector.git
cd codingame-connector
npm install
Then you can launch it (see configuration below) with npm start
.
It's pretty simple, you give to the program a configuration file (default to
.codingamerc
) of the following form.
{
"username": "[email protected]",
"password": "myP4ssw0rd",
"exercise": "5711567e959cf54dd2dd79c1b4c259560d6ba46",
"tests": [1, 2, 3, 4, 5, 6],
"language": "Python",
"bundle": "bundle.py"
}
There is 3 different ways to give your username and password.
As simple as the following.
{
"username": "[email protected]",
"password": "myP4ssw0rd",
...
}
You can also give a command in the configuration file, the output of this
command will be considered the username or password. For example, imagine you
encrypted your username
and password
in GPG files username.gpg
and
password.gpg
with the following command.
gpg2 --encrypt username
gpg2 --encrypt password
Then you could use the following in your configuration file.
{
"username": ["gpg2", "--decrypt", "username.gpg"],
"password": ["gpg2", "--decrypt", "password.gpg"],
...
}
Note that you might want to encrypt only the password.
{
"username": "[email protected]",
"password": ["gpg2", "--decrypt", "password.gpg"],
...
}
If you don't put anything in your configuration file, the software will ask for it and keep them as long as the software is running.
To find the exercise
hash, you'll have to open the webbrowser, browser to the
exercise you'll try to solve and open the IDE. Then look into your URL, you'll
find the hash.
tests
are an array of all the test's number available in the IDE of Codingame
(not the validators!).
Is a value among all the available languages in Codingame. Be careful of the
case as Python
will work but python
will not.
bundle
is the path towards the file containing your code.
If you prefer to not put your username
and password
in a plain file on your
filesystem, don't put the fields, they will be asked when the program is
launched and kept in memory (not safe but at least safer). The connection
towards the website is encrypted (HTTPS).
codingame-connector
will continuously watch the file bundle
for any change.
Each time the file is changed and saved, codingame-connector
will launch the
tests on Codingame. Note that it will stop to test on the first one that fail.
To get an idea, see this asciinema.