Settings

Theme

Show HN: Tinytetris – 80 x 23 Terminal Tetris

github.com

147 points by taylorconor 7 years ago · 53 comments

Reader

bitwize 7 years ago

Friendly reminder: Tetris is one of the most valuable, and vigorously defended, game IPs in the world. Such aspects of the game as the dimensions of the playfield and the shapes of the tetrominoes are protected by copyrights and trademarks belonging to Tetris Holdings LLC -- and Tetris Holdings is Oracle-tier litigious. Yes, this has stood up in court. Hope you like unfriendly C&Ds from powerful attorneys.

  • cdubzzz 7 years ago

    Have they ever actually ended up in court? I was on the receiving end of one of these letters many years back for a clone I was involved with, but we just kept distributing it for a long time and they just sent basically the same letter a few years later. The primary developer eventually stopped the project only because he moved on to other things.

    I feel like back then we didn’t find any cases backing up TTC’s claims, but I haven’t kept up over the years.

    • bitwize 7 years ago

      Look up Tetris Holdings, LLC v. Xio Interactive, Inc. The court found 100% in favor of Tetris Holdings, in particular noting the shape of the tetrominoes, the way the tetrominoes spun and fell, and the dimensions of the game board as protectable elements under U.S. copyright law. Since this ruling was handed down, Tetris has applied for and received U.S. trademarks on the tetromino pieces.

      The upshot of this is that it is illegal to develop a clone of Tetris. It doesn't matter whether you call it Tetris or not, or whether you use "ripped" or copied assets or not -- the very fact that you have copied Tetris means you are infringing. It may be illegal to develop a video game that uses tetrominoes at all since the tetromino pieces are protected trademarks of The Tetris Company.

      • defertoreptar 7 years ago

        Copyright does not protect game mechanics and rules. In Tetris v. Xio, they successfully argued that the game infringed on trade dress.

        They claimed that the pieces looked like ones in other games, which in my view is impossible not to infringe on since there have been hundreds of Tetris games with every type of piece design possible.

        They claimed that they used tetrominos, and the playfield was twice as high as it was wide, and so on. What Xio failed to point out was that all of these are functional aspects of the game, which means it is not protected by trade dress. Even the original creator, Alexey Pajitnov, has said that he originally tried pentomonoes, but that was too difficult, so he used tetrominos instead. That's functional, not trade dress.

        Do you have a source for Tetris's trademarking tetrominos? Perhaps you're referring to their "tetrimino" label, which their own term for what the non-branded world refers to as "tetrominos."

        • bitwize 7 years ago

          Xio did, in fact, attempt to point out that the shapes of the tetrominos are functional elements and not subject to trade dress. The judge disagreed.

          The judge also said that while copyright does not protect the abstract concept of a falling block game, he specifically cited the shapes of the blocks and the playfield size as copyrightable.

          It's settled U.S. case law. If you develop a clone of Tetris, you are infringing on The Tetris Company's copyrights and trademarks and may be subject to civil and criminal penalties under U.S. law.

          IF YOU DON'T WANT TO BE SUED, DON'T EVER WRITE A TETRIS CLONE. PERIOD.

          • defertoreptar 7 years ago

            In the ruling, the judge states, "The style, design, shape, and movement of the pieces are expression; they are not part of the ideas, rules, or functions of the game nor are they essential or inseparable from the ideas, rules, or functions of the game."

            Clearly the judge disagreed that these elements weren't protectable, but do you agree? I'm say that I don't agree with the judge. Changing the the kind of polyominoes will make the game easier or harder (imagine how easy it would be with dominoes). Changing the playfield dimensions also changes the difficulty: a lower ceiling as well as a narrower well makes it much more difficult to survive.

            • bitwize 7 years ago

              Well if you're sitting on a pile of startup exit cash and can hire a Boies-tier attorney, go ahead and write that Tetris clone. You'll get your day in court to test those theories of yours, soon enough, and you can appeal it all the way to the Supremes if you wish.

              As things stand, though, the law of the land as established in federal courts says those elements are copyrightable, and under copyright. So it doesn't matter a fig what you or I think of the judge's ruling -- the law is clear.

              • defertoreptar 7 years ago

                If you are new to programming, I would actually recommend making a Tetris clone. It's a great learning experience. Obviously if you're worried about receiving a cease and desist, then don't put it on sale on the app store.

          • derefr 7 years ago

            Does U.S. case law matter if you create and distribute your game in a country that is not the U.S.?

            Funny thought: what would happen if a student of the Russian Academy of Sciences created a Tetris clone? ;)

            • balodja 7 years ago

              Two fun facts here.

              First one. Russian Academy of Sciences(RAS) doesn't hold students. That's an authority that manages the network of research institutes. Educational institutes are separated from that network in Russia.

              Second one. Pazhitnov really worked in one of the RAS institutes when created tetris.

      • derefr 7 years ago

        That doesn't sound right. Physical, non-video-game instantiations of tetrominoes exist, and Tetris Holdings, LLC presumably doesn't hold trademark over those.

        It'd be like trying to trademark a d20. Sure, one with symbols/numbers on it, as viewed from a certain angle, stylized a certain way, might be trademarkable as a mark (i.e. a logo.) But isocahedrons generally? They're mathematical objects.

        Which means that, presumably, you could make a Tetris clone as a board game (which would work a bit like Connect Four, I guess) without any exposure.

        • bitwize 7 years ago

          Trademarks are funny in that they are confined to certain markets. If you do not compete in a trademark owner's business, you can use the mark. You see this in the wild: the word Namco, for instance, is trademarked to a Japanese video game company and an American swimming pool company. The word Shazam can refer to a superhero owned by Warner Bros., an app owned by Apple, or a financial services company called Shazam Inc. with a separate trademark for all three. And there's some interesting trademark history behind the name "Apple" itself!

          So yes, while the tetrominos being a Tetris Company trademark precludes their unlicensed use in video games, they can be used in other contexts -- a tetromino pattern on pyjamas or wallpaper, for instance.

          However, I would be wary about attempting to use them in a board game, as I seem to recall at least one licensed Tetris board game in the wild. Consult an attorney before proceeding. :)

          • defertoreptar 7 years ago

            > So yes, while the tetrominos being a Tetris Company trademark precludes their unlicensed use in video games

            Tetrominoes are not a Tetris Company trademark. They have, however, trademarked the word "tetrimino."

legohead 7 years ago

There used to be a playable Tetris in the favicon, which I found from HN[1], but it looks like the website[2] is dead now :(

[1] https://news.ycombinator.com/item?id=3873623

[2] http://favris.info/

  • themodelplumber 7 years ago

    There was also a suite of Windows games I played back in ~2003 that occupied maybe a 32x64 window each, and one of them was mini Tetris. As I recall, the developer was Israeli. Anyway it was awesome for playing casually in stealth mode; there were no window decorations and the games were well made. I think one of the other games was pool. I haven't been able to find them since.

  • dannyw 7 years ago

    Probably because of how vocal Tetris's IP lawyers are.

    • colejohnson66 7 years ago

      From what I understand (correct me if I’m wrong), they don’t care if you make a Tetris game, just don’t have the name “Tetris” in your title.

amasad 7 years ago

Cool! I made a demo playable in the browser: https://repl.it/@amasad/tinytetris

Or run it directly here: https://tinytetris.amasad.repl.run/

twic 7 years ago

I didn't think i'd ever read a Tetris implementation more incomprehensible than sedtris [1], but here we are.

[1] https://github.com/uuner/sedtris

alpn 7 years ago

To quickly build and run from your terminal:

   git clone https://github.com/taylorconor/tinytetris && cd tinytetris
   gcc tinytetris.cpp -lcurses -o tetris && ./tetris
  • coolreader18 7 years ago

    Or straight from curl:

        curl https://raw.githubusercontent.com/taylorconor/tinytetris/master/tinytetris.cpp | gcc -x c++ - -lcurses -o tinytetris
kd5bjo 7 years ago

Very nice; writing minified code is a challenge I've never been particularly good at.

As it happens, though, I had a university assignment due today to write a WebGL falling-triomino game:

  Start game: space
  Rotate: a/z s/x d/c
  Move: arrows
  Drop: space
http://2-71828.com/T%C3%B6lvugraf%C3%ADk/Verkefni03/tris.htm...
baddox 7 years ago

You could probably go even smaller by using higher resolution characters, like Braille, but without the per-block colors.

  • mkl 7 years ago

    One time in high school I made a Tetris clone (in one lunch hour!) with single pixels as the squares, and used the VGA video memory itself as the data structure for the current board state. It was in 320x200 resolution, so the pixels were pretty big (the game area itself was only a small rectangle of them). My version didn't detect when the pieces reached the top or keep score or anything, just the basic playable mechanics.

classichasclass 7 years ago

With ncurses it runs out of the box on my POWER6 AIX machine, so A for portability. I'd give you an A+ if I had xlc installed locally, but I cheated a little and used gcc. (For ncurses, I used the perzl pre-built library.)

abhinai 7 years ago

Fascinating! Are there any easy to follow tutorial on how to manipulate pixel blocks (I wonder what the right term is) inside terminals?

  • the_pwner224 7 years ago

    If you're referring to the game pieces, the creater probably just used these Unicode characters: https://en.wikipedia.org/wiki/Block_Elements

    • JdeBP 7 years ago

      As you can see from the program and screenshot right in front of you, xe did not.

      It's one of only two printw()s in the code, and the screenshot shows the result quite clearly.

      • the_pwner224 7 years ago

        You are correct; the code to print the blocks is on lines 35-37 of tinytetris-commented.c.

        But the large comment at the top of the tinytetris.c file is made of the block drawing characters :)

        The attron sets terminal attributes which presumably cause it to flip the " " into a solid block. I haven't decoded what exactly the number it's feeding in represents, but 262176 is 0b1000000000000100000, and the attributes are defined around line 1100 of curses.h on my system (/A_NORMAL will find it).

        • TomJansen 7 years ago

          the attron() used is attron(A_REVERSE | COLOR_PAIR(n)). The OR operator is used to combine attributes in curses.

  • AceJohnny2 7 years ago
blondin 7 years ago

amazing op! tetris is one of those game on my need to implement list and never actually finished an implementation :)

  • zrobotics 7 years ago

    Don't let yourself get hung up on doing anything fancy, it's just fun to do. Seriously, just implementing tetris in processing is a fun way to spend an hour, and a great way to remind yourself of why programming is fun. It doesn't involve anything crazy as far as algorithms, but is a fun challenge to do. It's definitely worth it to implement a version, it is just fun to do.

  • colejohnson66 7 years ago

    I found this a while back: http://javilop.com/gamedev/tetris-tutorial-in-c-platform-ind... It’s Tetris in C++, so it should be easy to adapt it to a C like language (or other if you can follow the logic)

svnpenn 7 years ago

It's a quine

  • benj111 7 years ago

    Is it? I see no mechanism for outputting anything other that the game board.

    And theres no mention on the site.

mhiming 7 years ago

Here’s a 509 byte JavaScript Tetris https://github.com/veu/mini-tetris

sys_64738 7 years ago

On my Mac I can just type:

'emacs -f tetris'

  • zapzupnz 7 years ago

    Yes, but that's rather besides the point. It's not the fact that it's Tetris in a terminal; it's also the fact that it's minified code. Look at the GIF on the Github page; that's the code of the game.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection