NOTE: In some of these commands you may require
sudo depending on your systems configuration
We start our journey with
termicoder view contestsand
termicoder view problems
they give you a list of contests running on a judge and problems of a contest respectively
termicoder view contest -j codechefwill list running and future contests on codechef
termicoder view problems -j codechef -c cook84will list all the problems of contest cook84 sorted in descending order of no of submissions
Next you have to setup problem/contest using
this command creates a directory structure for contests and problems with details such as problem statement, submission info and testcases.
All the happens in your current directory.
termicoder setup -j codechef -c cook84will setup all the problems from contest cook84 form codechef
after this command you will have a structure similar to following in your current directory:
instead of names PROB1 and PROB2 the names would be actual problem codes
you can view the directory using
lson bash or using
DIRon command prompt
.contestfiles contain data such as contest code, problem code, judge,timelimit etc. used by termicoder in submitting and testing data
Now you can choose any of the problems to begin
Note that most commands such as
testwork on the basis of your current folder
so first change your folder to the desired problem folder.
on bash you can do this using
cd foldernamefor command prompt use
chdir folder namefor the following example we will assume using bash
say we want to begin with PROB1
so we run
termicoder view this
this opens the problem statement (which is saved as html file by termicoder in a problems directory) in your default browser. You can change defaults using
termicoder view this -edwe recommend use of a commandline browser such as w3m/elinks
NOTE from now we will assume we are in the folder PROB1 untill we say otherwise
Now we have viewed the problem and say we are ready to code.
termicoder currently only supports c,c++,java,python
so we use the command
this command helps us in coding the solution.
it puts the template for a language into the given file and opens the problem form editing in the default editor e.g.
termicoder code -f a.cppwill create a file a.cpp in current folder loaded with the cpp template and launch the file for editing in your system default for cpp files.
you can edit default templates using
termicoder code -et
you can edit default editor using
termicoder code -ed
Now say we have coded the solution and we are ready to test this. for this we use command
this command requires us for a code file to test if we don’t pass a code file it will automatically look for code files(files with extension .c, .cpp, .py, .java) in the current folder and suggest the latest edited file as default we just have to press enter as in following example.
after supplying a code file this command (compiles and) runs your code on all testcases and produces diff of reqired and produced outputs
Please provide a code file[a.cpp]:
after pressing enter, a.cpp is taken as the file, after this termicoder should compile the code(if required).
Since people use different compilers and systems, compile commannds may vary so instead of hard coding them termicoder uses bash/batch scripts for compiling and running your code
Some sample scripts have been bundeled for each language but there is quite high chance that they might not work so you need to edit them first. For more details have a look at CONFIGURE.
To edit scripts run
termicoder test -et
After compiling, termicoder runs your code against all
.infiles in testcases folder
and produces output as a corresponding
for example if input is
1.in, output is produces as
now the file is compared with corresponding
.outfile which have the expected(correct) output
1.outxis compared against
after running on all
.infiles it produces status of each case and diff of the outputs. You can simply add your own testcase by creating a
.infile and corresponding
.outfile in testcases folder.
there is no restriction on file name except that they should be same for corresponding
The output should match exactly(including spaces) for termicoder to produce AC.
We do exact check to support accross various judges and problems.
If it evaluates WA does not always mean that judge will also give WA; You should have a look at diff and .out/.outx files
test command also has options like timelimit which can be used to set time limit per testcase
by default it is the timelimit specified in
.problemfile. if not specified it is 3 seconds by default ex.
termicoder test -f a.cpp -tl 0.1makes timelimit 0.1 second per testcase
to not use testcases files and run the program live use
termicoder test --live
it just compiles and runs the program normally taking from stdin and producing to stdout
after testing program and say producing correct output we need to submit our solution
for that we need to login first.
to login use
termicoder setup --login -j codechef
it prompts you for username and password and logs you in.
we currently don’t support saving username and passwords.
but we do save cookies and maintain session which help reducing trouble to user,
though the cookies become invalid soon; the limit depends on judge
You will have to login again after cookies expire.
Also you can logout anytime using
termicoder setup --logout -j codechefwhich deletes the cookies.
The cookies may become invalid if you login from some other browser
After we login we can submit a solution using
termicoder submit -f a.cpp
it gives a confirmation prompt and submits the solution based on data in
after the judge has evaluated we show you the response.
Note that if we don’t provide option
termicoder prompts for a code file similar as the test prompt defaulting to latest code file you edited.