pygame is
Simple DirectMedia Layer is
Site Swing
Tetris in 73 Lines

Tetris in 73 Lines - 1.00

Jordan Trudgett (tgfcoder)



Tetris written in 73 lines. Was originally 150+, then
removed comments, extra space (indentation spacing and also
"x = 5", "6, 7, 8, 9" spaces for example) and put anything possible onto one line, separated by semi-colons.
The code itself is 2.6K and is 73 lines (probably can still be shortened.)

See if you can work out what each part does! (The list
manipulations would be the trickiest, I think.)

I was inspired by a similar tetris game written in 256
bytes... it probably does less than mine, but I thought it
was still damn impressive. :P
For a less sadistic approach to Python, see my
masterpiece-in-progess, Ardentryst.


  • Left: move block left
  • Right: move block right
  • Up: rotate block
  • Down: push block down space drops. Game over to quit. :P


Home Page:


click to view original size


Tetris in 73 Lines - 1 - Mar 10, 2013
Tetris in 73 Lines - 1.00 - Jun 30, 2008 account Comments

If you wish to leave a comment with your account, please sign in first.

March 17, 2013 1:40pm - Jason - nickname: (jasonspine) - 5/5 - beat this :D
July 2, 2008 10:47pm - Vitor Bosshard - nickname: (algorias)
Me know, me know, was just very fun making of fact that you use translator! Bilingual joke it was, as too is this.
July 2, 2008 9:36pm - Jordan Trudgett - nickname: (tgfcoder)
I meant that I don't speak Spanish. :P
July 2, 2008 7:09pm - Vitor Bosshard - nickname: (algorias)
What do you mean you have a bad tongue? Está podrida o algo? ;)
July 1, 2008 3:57pm - Jordan Trudgett - nickname: (tgfcoder)
@juanchi: Estoy utilizando un traductor para hablar español porque hablo inglés así que lo siento para la mala lengua;

Tenga por favor una mirada en mi juego, el Ardentryst (, quizá que apelará más a usted. :)
July 1, 2008 3:55pm - Jordan Trudgett - nickname: (tgfcoder)
*compressed meaning removing extra spaces, comments, shortening variables names, reusing variables names, etc.

Wouldn't it be fun to try and understand it? For example, which line rotates blocks? :D

If you want to an example of my normal code-writing style, look at the game Ardentryst
July 1, 2008 3:50pm - Jordan Trudgett - nickname: (tgfcoder)
"And yes, the code is obfuscated on purpose."

Please read the description.

I wrote it normally first, then compressed it to make it as small as possible.
That was the entire point.
July 1, 2008 12:55pm - Anonymous - nickname: (pywiz32)
WOW... Unreadble because of really bad variable names, no commenting, and implicit use of varibles. How this even runs is a mystery to me.
July 1, 2008 12:46pm - Anonymous - nickname: (pywiz32)
Great game. Add in being able to press escape to quit. Too bad you made it horrible code. I never even knew you could put the entire initialazation methode on one line. I'll see if I can decode it.
July 1, 2008 9:00am - pymike - nickname: (pymike)
LOL the code is a mess but the game plays pretty good :-D

I found one of those bugs you mentioned.. if you press left or right when next to a block you "catch" on it. Maybe add one more line to fix it? ;-D

BTW I got the code down to 70 lines of code :-D
July 1, 2008 8:56am - juan bruno abbona soffita - nickname: (juanchi)
esta bueno pero la mayoria de los chicos de hoy buscan los juegos de animes(dragon ball z,naruto, inuaya,etc)
July 1, 2008 3:04am - Jordan Trudgett - nickname: (tgfcoder)
Haha, there are a few bugs and stuff. It wasn't made to be a good example of code-writing, but moreso code-destroying. If you would like me to write this with good structure, comments, etc., I may consider it. Depends how much you want it :P
July 1, 2008 2:49am - Michael Arevalo - nickname: (sandhandle) - 4/5
DUDE, I've been searching for a nice Tetris clone to learn by reading the source code. This runs exactly like I want it to...but Wow, just WOW.

such a shame, it runs perfectly ;_;
4 out of 5 for untraceable code

our projects welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
recent releases
Feb 21, 2017

Jan 31, 2017

Jan 24, 2017

Jan 18, 2017

Jan 7, 2017

Dec 30, 2016

Dec 8, 2016

Nov 28, 2016

Nov 27, 2016

... more!
for pygame related questions, comments, and suggestions, please see help (lists, irc)