Take the Learntris Challenge!

Learntris is a programming challenge: a set of automated tests that guide you through implementing a simple version of Tetris, the famous Russian falling blocks game.

Is this a tutorial?

Nope.

A tutorial shows you how to do something. A programming challenge tells you what to do, but it's up to you to figure out the implementation.

You can use any programming language, libraries, or tools you like, as long as your solution passes the tests.

How does it work?

The challenge is composed of a series of acceptance tests that specify input to be sent to your program along with the expected output.

To work through the challenge, you install a small python program called tanco and tell it how to run your program on your local machine.

You run tanco login to connect to the challenge server, tanco init to select and start a challenge, and tanco check to make sure it can run your program.

Next, you log into the server with your web browser to read and run the tests. When you start, it will look something like this:

The circles in the upper right indicate your connection status. The rightmost circle is green because this browser has a websocket open to the server.

The left circle is red because tanco has not yet connected to the server. The tanco share tells tanco to open its own websocket connection to share your program with the server.

The tests are given to you in sequence, one at a time, so at the start, there are no tests. You use the tanco next command (or the "Next" button in the web interface) to take on a new test. You must pass all the current tests before you can add a new one.

The reason you have to explicitly ask for each test is so that between tests, you have time to make changes to your program and run all the previously passed tests to make sure you haven't broken anything.

The workflow looks like this:

Here's an example of one of the early tests:

You can see the input is T t q. These are commands that your program has to parse. In this case:

The expected output is a printout of the tetromino in its bounding box, with the letter m indicating a magenta-colored block, and . indicating an empty space. (The bounding box is used for rotation, so it's always a square).

Once you've implemented enough tests, you will have the internal logic for a simple version of Tetris. You can then write your own frontend, or you can use the graphical lt-shell to play the game on your own machine. (Note: lt-shell is usable, but still under development. Maybe you can help?)

What does it cost?

Nothing! Learntris is free!

Wait. Why is it free?

I wrote the Learntris test suite many years ago (early 2010s) while mentoring programming students over IRC. At the time it only ran in the terminal, and the interface was quite clunky.

As of 2024, I'm working on a new series of programming courses that follow this approach. I built tanco so that I could make much richer and more interactive challenges (like adding diagrams or allowing students to choose different paths), and also so I can see what students are doing and figure out where they need help.

Anyway, since Learntris has always been free, I decided to keep it that way. My hope is that people will try it out, I'll get feedback on the test platform, and maybe some of you will like it enough to sign up for future challenges.

If you want to know more about future developments, you can join our discord server or the tangentcode-news mailing list.

But who are you?

Oh, right. :)

My name's Michal, but I go by @tangentstorm online.

Okay, How do I take the challenge?

You need to install tanco and set things up. The tanco setup page will step you through it.

Have fun!