Skip to content
Chris edited this page Aug 3, 2015 · 3 revisions

To work through learntris, you will need:

  • a compiler and interpreter for your language.
  • a recent version of python (2.7.x or 3.x) for running the tests

Running the tests

To run the tests on windows using cmd.exe, do this:

c:\learntris> c:\python27\python.exe testris.py

Under cygwin / mingw / git bash on windows:

$ cd /c/learntris
$ /c/python27/python testris.py

On FreeBSD, OSX, linux, and other posix-style systems:

$ python2.7.6 testris.py

(Obviously, you should change the paths based on your actual system.)

testris.py will attempt to run a program called learntris in the current directory. (That would mean learntris.exe under windows) If your implementation language doesn't produce executable binaries, see the next section.

Running programs other than executable binaries.

The first test is designed so that pretty much any program that loads successfully and then terminates without producing any output will pass.

Let's say that you want to write your code in python2.7. (You can implement learntris in any language, or any version of python, but the testris.py times out under python 3. (Maybe you can fix it?))

To get the first test passing under python2.7 under windows, you can use the following program:

# this is learntris.py
pass

Since your implementation isn't named learntris.exe, you need to tell testris.py what command to execute:

c:\learntris>  c:\python27\python.exe testris.py c:\python27\python.exe learntris.py

On Linux you simply use:

$ ./testris.py --shell ./learntris.py

The first test should pass, the second test should fail, and your job is now to get them both working. :)