tt: Tetris for Terminals

24th May 2013

||                    ||  TETRIS FOR TERMINALS
||                    ||
||                    ||  Written by Mike Taylor
||          %%%%      ||  Email: maujf@uk.ac.warwick.cu
||        %%%%        ||  Started: Fri May 26 12:26:05 BST 1989
||      ######        ||
||        ##          ||  Game level: 12  Game mode: 0
||        %%%%        ||
||      %%%%        ()||  Score:  41
||{}<><><><>    ()()()||  Pieces: 13
||{}{}{}              ||  Levels: 0
||    ##              ||
||    ####            ||    Use keys:
||    ##          %%  ||    =========
||    %%%%    ##  %%%%||    Move left:  ','
||  %%%%    ######  %%||    Move right: '/'
||    <>  <><><><>%%%%||    Rotate:     '.'
||    <>        %%%%  ||    Drop:       ' '
||    <>          [][]||    Pause:      's'
||    <>          [][]||    Quit:       'q'
++====================++    Refresh:    '^L'


1. Download
2. Origins
3. Derivatives
        3.1. 3
        3.2. Pentris
        3.3. TNT
4. Unusual Deployments
        4.1. Mini-Linux
        4.2. Embedded system
        4.3. tt for BeOS
5. Licence
6. Further Information

1. Download

I'm releasing versions of this starting from 14.0, because as I write, it's fourteen years and a day after I started writing tt, and it seems silly to release a fourteen-year-old program as version 1.0.

Release 14.0 is deliberately more or less unchanged from the 1989 version. I've resisted the urge to clean up the source code, because there's a certain historical significance to the original (for me, anyway). Versions from 14.1 onwards will progressively tidy things up.

2. Origins

tt was the first Free Software I ever wrote, back when I was at Warwick University in the late eighties.

Back in those days, nearly everyone in the computer unit had access only to 80x24 serial terminals, while a few exalted souls - postgrad students and suchlike - had accounts that were good for the ten or so Sun workstations in the ``graphics lab''. And of course, they spent all their time using their fabulously powerful 68k-based workstations to play Tetris.

It seemed to me that Tetris was a game that should be brought to the masses - it's not as though it makes excessive graphical demands, after all - and so, one Friday lunchtime, tt was born. Which is why, all through the summer term of '89, the Warwick computer unit resounded to cries of ``I need a long one'', ``Leftleftleftleftleft!'' and, of course, ``Arrrrggghhh!''

tt turned out to be amazingly popular for such a simple hack. At some stage in the summer of '89 I posted it on one of the source-code newsgroups - probably either comp.sources.unix or comp.sources.misc - and various mutant versions have grown up out there over the years, including some that use colour and some with more complex scoring systems. Much as I respect the craft that went into these projects, I eschew their complexities, preferring the sharp, astringent, spartan feel of ``tt Classic'' to their various ``enhancements''.

3. Derivatives

3.1. 3

More interesting variants of tt soon began to spring up at Warwick. The first and probably the best was Harvey ``Max'' Thompson's 3 (a.k.a. t3), in which the blocks are made up of just three squares, but they may be joined diagonally as well as orthogonally, so that there are six kinds of block that look like this:

	        <>                            ##    {}  {}
	[][]    <>    %%%%        @@@@      ##        {}
	  []    <>        %%    @@        ##
  

At first, 3 seems impossible to the experienced Tetris player; but gradually, a different way of thinking about shapes emerges, and it's possibly to score well into the thousands.

I merged the 3 pieces back into the main tt source code; you can play it using the -3 command-line option.

3.2. Pentris

Next out of the blocks was Kenton Oatley's Pentris, which is what it sounds like: there are eighteen(!) different kinds of block, being all the different combinations of five squares joined orthogonally. To accomodate these larger pieces, the playing field is fifteen spaces wide rather than the standard ten spaces provided for Tetris proper and 3.

I merged the Pentris pieces back into the main tt source code; you can play it using the -5 command-line option.

3.3. TNT

Pete ``Gandalf'' Favelle came up with the idea of throwing the Tetris and 3 pieces together in a single game - ``Tetris 'n' Three', or TNT for short.

As with 3 and Pentris, I merged the TNT pieces back into the main tt source code; you can play it using the -7 command-line option (because 3+4 = 7).

4. Unusual Deployments

4.1. Mini-Linux

In June 1997, I heard from Frank Taylor that he'd installed Mini-Linux on his laptop, from a set of four 1.44Mb floppies. (It's a tiny but complete Linux distribution that unpacks onto an MS-DOS filesystem, which you boot into from DOS.)

Poking around in the games directory, he found tt, alive and well. I don't know if it's any of the more mainstream Linux distributions (I certainly can't find it in Debian, which is what I use) but it's nice to know that it did get included in at least one distribution!

Mini-Linux is, as I write, still available at sunsite.lanet.lv/ftp/unix/mini-linux so if you're prepared to go through the download/unpack/install cycle, you can see for yourself that tt is there!

I wonder how many magazine covers it was given away on?

4.2. Embedded system

In January 2002, I was contacted by Eden Cohen, an engineer working on an embedded real-time communications box that has a serial interface for configuration using a terminal. He thought it would be nice if the bored technician on site could play Tetris on the terminal, so he politely asked permission to use tt for this. I said yes, of course, and I am waiting to see what comes of it.

4.3. tt for BeOS

Todd Nathan <todd@callapple.org> has ported tt to the BeOS operating system, using the ncurses library from www.bebits.com. You can download his version of the source code, modified from version 14.0:

5. Licence

Notwithstanding the bespoke terms-and-conditions wording in the README file, I herely declare that tt is licenced under the GNU General Public Licence v2.

6. Further Information

You can read the following files from the distribution on-line:

Feedback to <mike@miketaylor.org.uk> is welcome!