14 ms·
Show HN: Tinytetris – 80 x 23 Terminal Tetris
- sys_64738 8y agoOn my Mac I can just type: 'emacs -f tetris'
- zapzupnz 8y agoYes, 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.
- amasad 8y agoCool! I made a demo playable in the browser: https://repl.it/@amasad/tinytetris https://repl.it/@amasad/tinytetris Or run it directly here: https://tinytetris.amasad.repl.run/ https://tinytetris.amasad.repl.run/
- yihsiu 8y agoIs it just me? I can't make any operations, and tetrominoes did not drop from center (horizontally), but kind of from random position
- Arkanosis 8y agoTry wasd instead of arrows. And yes, the starting position of new pieces looks random.
- OrgNet 8y ago> Or run it directly here: https://tinytetris.amasad.repl.run/ https://tinytetris.amasad.repl.run/ I needed to allow requests to five 3rd party domains for this tiny Tetris to load (uMatrix)
- deleted 8y ago[deleted]
- bitwize 8y agoFriendly 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 8y agoHave 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 8y agoLook 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 8y agoCopyright 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."
- classichasclass 8y agoWith 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.)
- baddox 8y agoYou could probably go even smaller by using higher resolution characters, like Braille, but without the per-block colors.
- mkl 8y agoOne 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.
- legohead 8y agoThere 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 https://news.ycombinator.com/item?id=3873623 [2] http://favris.info/ http://favris.info/
- dannyw 8y agoProbably because of how vocal Tetris's IP lawyers are.
- colejohnson66 8y agoFrom 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.
- themodelplumber 8y agoThere 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.
- slazaro 8y agoHave you tried asking in the subreddit "tip of my tongue" [0]? I have been amazed at what they can figure out about obscure stuff with very abstract clues. [0] https://www.reddit.com/r/tipofmytongue/ https://www.reddit.com/r/tipofmytongue/
- themodelplumber 8y agoGood idea! Thank you for the suggestion. Edit: Actually just found the old site thanks to Google Groups :-) http://web.archive.org/web/20030501044223/http://www.tinywindowsgames.com/ http://web.archive.org/web/20030501044223/http://www.tinywin...
- blondin 8y agoamazing op! tetris is one of those game on my need to implement list and never actually finished an implementation :)
- zrobotics 8y agoDon'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.
- taylorconor 8y ago+1! And there are plenty of helpful tutorials around if you get a bit stuck!
- colejohnson66 8y agoI found this a while back: http://javilop.com/gamedev/tetris-tutorial-in-c-platform-independent-focused-in-game-logic-for-beginners/ 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 8y agoIt's a quine
- benj111 8y agoIs it? I see no mechanism for outputting anything other that the game board. And theres no mention on the site.
- taylorconor 8y agoIt's not a quine :)
- benj111 8y agoHow has the parent not been downvoted to oblivion then? Edit: I see you're the author, I'll take your word for it :) Nice work btw.
- abhinai 8y agoFascinating! Are there any easy to follow tutorial on how to manipulate pixel blocks (I wonder what the right term is) inside terminals?
- AceJohnny2 8y agohttps://www.linuxjournal.com/content/getting-started-ncurses https://www.linuxjournal.com/content/getting-started-ncurses
- the_pwner224 8y agoIf you're referring to the game pieces, the creater probably just used these Unicode characters: https://en.wikipedia.org/wiki/Block_Elements https://en.wikipedia.org/wiki/Block_Elements
- JdeBP 8y agoAs 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 8y agoYou 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 8y agothe attron() used is attron(A_REVERSE | COLOR_PAIR(n)). The OR operator is used to combine attributes in curses.
- alpn 8y agoTo quickly build and run from your terminal: git clone https://github.com/taylorconor/tinytetris && cd tinytetris gcc tinytetris.cpp -lcurses -o tetris && ./tetris
- coolreader18 8y agoOr straight from curl: curl https://raw.githubusercontent.com/taylorconor/tinytetris/master/tinytetris.cpp | gcc -x c++ - -lcurses -o tinytetris
- kd5bjo 8y agoVery 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.html http://2-71828.com/T%C3%B6lvugraf%C3%ADk/Verkefni03/tris.htm...
- mhiming 8y agoHere’s a 509 byte JavaScript Tetris https://github.com/veu/mini-tetris https://github.com/veu/mini-tetris
- twic 8y agoI 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 https://github.com/uuner/sedtris
- ksaj 8y agoHere it is in a rather ambitious toy assembler language created specifically to play tetris using Conway's Game of Life rules. Trying to grok it will melt your brain on multiple levels. http://play.starmaninnovations.com/qftasm/#jllHdnBGSP http://play.starmaninnovations.com/qftasm/#jllHdnBGSP