Tetris In 140 Bytes 215
mikejuk writes "Is it possible to write a JavaScript program in no more than a tweet's length? A website called 140byt.es says it is and has an implementation of Tetris to prove it. Ok, it only has two types of block — hence its title "Binary Tetris" — and there's no rotate, but it works. The blocks fall down the screen and you steer them into place. You can try it out by playing the demo. Of course the real fun is in figuring out how it works and there is lots of help on the site — so if you're bored how about the 140 character challenge?"
Somewhat Misleading (Score:5, Informative)
Not to diminish their accomplishment, because this is very cool, but the 140 byte implementation is the base logic, it's not the actual printing or keyboard handling. Maybe that's nitpicking, but technically you can't just copy/paste that code and have the game, so I find the summary misleading.
Dear /. Overlords (Score:5, Informative)
so if your bored
Dear /. Overlords,
Would it be too much trouble to plug some type of grammar and spelling module into the slash-code? /. users; for you, the /. editors. I believe that in this wonderful age of computing, we wouldn't
Not for us, the
begrudge you guys a little help before you hit "submit."
Sincerely,
You're
Re:Somewhat Misleading (Score:5, Informative)
Almost kilobyte? Yep, not very impressive considering what people build in 1 kB of Javascript [js1k.com].
Not to mention all the cool things people stuff in 512 byte intros for demo parties.
Re:Read the source code - love the licence.txt (Score:5, Informative)
You'll love the non-restrictive EULA.
It's called WTFPL [wikipedia.org].
Re:Somewhat Misleading (Score:5, Informative)
Fucken (Score:2, Informative)
proofread you're submissions. Sheesh, youse merkins all y'all illiterate, er wat?
Re:Nostalgia ... (Score:5, Informative)
Geesh... (Score:4, Informative)
#!/usr/bin/perl
use StupidShitIveWritten::Tetris(tetris);
tetris;
Re:Still not as good as: (Score:4, Informative)
Nor this http://survex.com/~olly/rheolism/ [survex.com]: real Tetris in one line of BBC BASIC, 255 bytes after tokenisation. All the shapes are stored in one 32-bit constant. It's just amazing.
Peter
Re:Nostalgia ... (Score:5, Informative)
The european versions had just 1k (two 2114 chips of 1k x 4 bit)
Fail - it's actually 845 bytes. (Score:5, Informative)
Re:Read the source code - love the licence.txt (Score:4, Informative)
I'm not sure if it's necessary or not, but in this particular case, it's a Tetris game, not a remote controller for sharks with freakin' lasers.
Re:Binary Tetris (Score:4, Informative)
Binary Tetris is based on dominoes instead of tetrominoes and is called Dis.
Re:Nostalgia ... (Score:5, Informative)
Trust me, 1kB.
To clarify this, you're right that the original versions of the ZX80 [wikipedia.org] and ZX81 [wikipedia.org] both had 1KB onboard.
However, the US version of the ZX81 (the Timex Sinclair 1000 [wikipedia.org]) shipped with 2KB onboard, which is probably what the GP was thinking of.
Re:Nostalgia ... (Score:4, Informative)
that would be roughly 2.3 lines of a card catalog card (assumes 12 point type and a 3X5 card)
Get off my lawn! (Score:4, Informative)
Back in the good ol' days, when men were men, and Java was just a retarded twinkle in Gosling's eye, we had 256-byte competitions in assembly language. Anything using an interpreter is an immediate disqualification, unless your interpreter + script somehow fit inside the 256 byte limit. Basically, any dependency that isn't part of the hardware, BIOS, or low-level OS functionality like disk I/O, must be included in the byte total. Libraries, interpreters, resource blobs, it all adds up.
And now, a real Tetris in 256 bytes: http://www.users.globalnet.co.uk/~jchap/tvprotet.htm [globalnet.co.uk]
Get that goddamned Javascript hack out of my face.
Re:Nostalgia ... (Score:4, Informative)
You can still download those.
... which will strip all superfluous blank lines from a file, leaving just single blank lines. /^1?$|^(11+?)\1+$/'' /^GET \/(.*) /})'
There are also annual "one-liner" contests for various languages, which have been around for at least a generation.
perl is probably the winner in one-liners. Including useful utilities like (all way smaller than 144 bytes):
perl -00pe0 filename
Or, to find all primes between 5000 and 5100:
seq 5000 5100 | perl -lne 'print if (1x$_) !~
Or, a simple working web server - actually useful to pull files from one machine to another:
perl -MIO::All -e 'io(":8080")->fork->accept->(sub {$_[0] < io(-x $1 ? "./$1 |" : $1) if
There's also this DOS/Windows gem:
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
Save it as eicar.com and your antivirus software should pick it up.
And you can execute it too (it's harmless, of course). A 69 byte binary executable that only contains ASCII characters.
All in all, the article submission isn't all that impressive.