Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Tetris Is Hard: NP-Hard

Posted by timothy on Fri Oct 25, 2002 01:21 AM
from the lots-of-chin-scratching dept.
bughunter writes "Analysts at MIT Laboratory for Computer Science, who have been busy translating, rotating and dropping, have demonstrated what the rest of us suspected: Tetris is hard. Technically, it's 'NP-hard,' meaning that there is no efficient way to calculate the necessary moves to "win," even if you know in advance the complete order of pieces, and are given all the time you need to make each move. At least there's one geek classic that refuses to fall to the scrutiny of mathematicians."
This discussion has been archived. No new comments can be posted.
Tetris Is Hard: NP-Hard | Log In/Create an Account | Top | 345 comments (Spill at 50!) | Index Only | Search Discussion
Display Options Threshold:
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1) | 2
  • Winning (Score:3, Interesting)

    by scotch (102596) on Friday October 25 2002, @01:23AM (#4527798) Homepage
    How the hell do you win at tetris? I remember it getting faster and faster but never ending. Maybe I just sucked at the game, or was playing a clone.
    • Re:Winning (Score:5, Informative)

      by agurkan (523320) on Friday October 25 2002, @01:30AM (#4527811) Homepage
      I think what is meant is, if the number of pieces is finite then finding a configuration for putting them without gaps is not polinomial in number of pieces.
      [ Parent ]
      • Re:Winning (Score:5, Informative)

        by travd (608286) on Friday October 25 2002, @03:35AM (#4528140)
        More particularly, they show that given an arbitrary size game board, and prior knowledge of the sequence of pieces, the problem of computing the optimal solution to four problems is NP-Hard:

        (1) Eliminating all blocks on the playfield in a minumum number of moves.

        (2) Maximising the possible number of tetrises obtained.

        (3) Maximising the number of lines cleared.

        (4) Minimizing the height of the block configuration.

        Note that they prove (1) essentially by starting from a very particular arrangement of blocks on the playing field, such that the reduction to 3-Partition is "easy" to prove (I use the word "easy" in the loosest sense). They then go on to prove (2),(3), and (4) using small modifications to the basic setup.

        The admit that the "empty initial field" problem is an open one, but I would imagine that that problem can also be proven NP-Hard.

        [ Parent ]
      • 2 replies beneath your current threshold.
    • Re:Winning by kjd (Score:3) Friday October 25 2002, @01:34AM
    • Re:Winning by targo (Score:3) Friday October 25 2002, @01:35AM
      • Re:Winning by silvaran (Score:2) Friday October 25 2002, @01:48AM
      • Re:Winning by AnyoneEB (Score:1) Friday October 25 2002, @09:55PM
    • Re:Winning by stevey (Score:3) Friday October 25 2002, @01:59AM
      • Re:Winning by krepta (Score:1) Friday October 25 2002, @03:14AM
      • 1 reply beneath your current threshold.
    • Re:Winning (Score:5, Informative)

      by Lars Arvestad (5049) on Friday October 25 2002, @02:17AM (#4527954) Homepage Journal
      Read the paper. One does not need to understand it to see what the actual questions are.

      The authors carefully defines that a Tetris problem is a starting board and a series of Tetrominoes. Several computational objectives are then defined, such as "can a game be played wherein k rows are collapsed?" or "can the board after the last tetrominoe have at most height k?".

      So it is really a mathematical version of Tetris, but it applies to regular Tetris in that there are certainly games that simply are too hard for you.

      [ Parent ]
    • Re:Winning by RovingSlug (Score:2) Friday October 25 2002, @02:38AM
      • Re:Winning by Gubble (Score:2) Friday October 25 2002, @04:22AM
        • Re:Winning by stu-pendous (Score:1) Friday October 25 2002, @07:33AM
          • Re:Winning by clarkcox3 (Score:1) Friday October 25 2002, @10:32AM
            • Re:Winning by zsmooth (Score:1) Friday October 25 2002, @11:56AM
              • Re:Winning by Jus ad Bellum (Score:1) Friday October 25 2002, @01:25PM
                • Re:Winning by zsmooth (Score:1) Friday October 25 2002, @02:32PM
                  • Re:Winning by RovingSlug (Score:2) Friday October 25 2002, @10:56PM
                    • 1 reply beneath your current threshold.
              • Re:Winning by clarkcox3 (Score:1) Monday October 28 2002, @08:22AM
        • Re:Winning by RovingSlug (Score:2) Friday October 25 2002, @10:59PM
        • 1 reply beneath your current threshold.
    • Re:Winning by Anonymous Coward (Score:1) Friday October 25 2002, @05:31AM
    • NP-hardness is ubiquitous by rew2 (Score:1) Friday October 25 2002, @10:35AM
    • 1 reply beneath your current threshold.
  • Tetris is NP-hard! (Score:5, Funny)

    by DeadMoose (518744) on Friday October 25 2002, @01:25AM (#4527802)
    Yeah, that's it; I'm not bad at it, it's just too hard. Just like, um, most every other video game I've played...
  • by aero6dof (415422) <aero6dof@yahoo.com> on Friday October 25 2002, @01:26AM (#4527803) Homepage
    No, I'm empirically testing some NP theories...
  • by Uhh_Duh (125375) on Friday October 25 2002, @01:27AM (#4527804) Homepage

    I don't get it. They used math to figure out that tetris is hard, but math is hard too. :(
  • Hey... (Score:5, Funny)

    by bluemilker (264421) on Friday October 25 2002, @01:28AM (#4527807) Homepage
    those guys are dumb. Everyone knows you just leave a single block wide path in the center... you're _sure_ to get a 4-long column before you hit the... ARGH! ... this would be so much easier if I had a version of tetris that told me all the pieces in advance, like theirs does...
    • Re:Hey... by tbspit (Score:3) Friday October 25 2002, @02:57AM
      • bastion strategy by Animaether (Score:3) Friday October 25 2002, @06:31AM
      • Re:Hey... (Score:4, Interesting)

        by athmanb (100367) on Friday October 25 2002, @09:22AM (#4529491)
        If you leve the open column in the center, you have an even count of blocks on the left side, and an odd count on the right side. This means you have more possibilities to stack different classes of blocks.

        Plus, you can use both right- and left-handed L blocks as a makeshift solution if your stack gets too high.
        [ Parent ]
      • where's the hole? by boarder (Score:2) Friday October 25 2002, @10:07AM
    • 1 reply beneath your current threshold.
  • In Other News (Score:5, Funny)

    by GroovBird (209391) on Friday October 25 2002, @01:31AM (#4527814) Homepage Journal
    Ron Rivest of RSA Security (NASDAQ: RSAS) announced that are releasing a new assymetric encryption algorithm based on Tetris. Since Tetris has been under the scrutiny of millions of people, experts say that it is much more secure than current outdated algorithms such as RSA and Elliptic Curve. This will bring a new era in computer security, Ron says.

  • by gpinzone (531794) on Friday October 25 2002, @01:31AM (#4527815) Homepage Journal
    Is to prove the P = NP challenge. I think I'll play Quake 3 instead.
  • Further studies... by Ravenn (Score:2) Friday October 25 2002, @01:31AM
  • by Steve Cowan (525271) on Friday October 25 2002, @01:32AM (#4527817) Journal
    Mathematicians simply can't concentrate on the movement of the pieces, even given all the time they need, because it's too easy to get distracted by that wacky Russian folk music.
  • I always sucked at tetris... (Score:4, Funny)

    by Cyno01 (573917) <Cyno01@hotmail.com> on Friday October 25 2002, @01:32AM (#4527818) Homepage
    the game would be a whole lot easier if every piece was only one block instead of four, but then i guess they'd have to call it monris or something
    • 1 reply beneath your current threshold.
  • Poll by SexyKellyOsbourne (Score:2) Friday October 25 2002, @01:32AM
    • Re:Poll by MrMetlHed (Score:2) Friday October 25 2002, @01:37AM
    • Re:Poll by robertchin (Score:3) Friday October 25 2002, @01:55AM
      • 1 reply beneath your current threshold.
    • Re:Poll (Score:5, Funny)

      by Limynali (620117) on Friday October 25 2002, @08:10AM (#4528918) Homepage
      Last weekend I was priviliged enough to hear Alexey Pajitnov, the creator of Tetris, give a talk on how he came up with tetris, the design process of games, etc... The best part was at the end somene asked him about the dificulty of Tetris and he replied that even though he knew that each piece had the same probabilty (because he coded it) there must be some little guy inside the computer purposefully giving him the 'wrong' pieces and witholding the one he needed, "that Son-of-a-bitch!" (yes, he actually said that)

      It's reasurring to know that even HE thinks it's rigged.
      [ Parent ]
    • 1 reply beneath your current threshold.
  • So that's why... (Score:3, Funny)

    by Ghoser777 (113623) <fahrenba&mac,com> on Friday October 25 2002, @01:34AM (#4527826) Homepage
    there's a security bug in kadmind4, as mentioned in the previous slashdot [slashdot.org] story! Instead of focusing on checking for buffer overflow errors, they were busy playing Tetris ;)

    [self duck];

    F-bacher

  • Tetris "ends"? by mcubed (Score:1) Friday October 25 2002, @01:34AM
    • Re:Tetris "ends"? (Score:5, Interesting)

      by fireboy1919 (257783) <rustyp@@@freeshell...org> on Friday October 25 2002, @01:52AM (#4527898) Homepage Journal
      Depends on the version. For the original gameboy version, in the count up mode (starting at level 1 and going up), you got to see images of a spaceship every 10 levels (if I remember right).

      It launched when you reached the final level, I think. I did it once, and was very happy, but it sure wasn't as much fun as the game itself.

      If you play the countdown mode (start with 40 pieces at a constant level and eliminate all of them) at the highest level (9, I think, or maybe 10), then when you finish you got to hear all of the instruments playing together (each of the other levels had instruments playing).

      The ending of Dr. Mario was a lot more interesting.
      [ Parent ]
    • Re:Tetris "ends"? by DEBEDb (Score:2) Friday October 25 2002, @02:12AM
    • Re:Tetris "ends"? by Jugalator (Score:2) Friday October 25 2002, @02:17AM
    • Re:Tetris "ends"? by Bill Currie (Score:2) Friday October 25 2002, @03:50PM
    • 2 replies beneath your current threshold.
  • I wonder... by SparkyTWP (Score:2) Friday October 25 2002, @01:34AM
    • Re:I wonder... by MrMetlHed (Score:1) Friday October 25 2002, @01:40AM
  • and yet by madsenj37 (Score:1) Friday October 25 2002, @01:34AM
  • Brain Strain in the Ukraine by vaguelyamused (Score:1) Friday October 25 2002, @01:35AM
  • man... that is so not fair (Score:4, Funny)

    by lingqi (577227) on Friday October 25 2002, @01:37AM (#4527838) Journal
    What the heck huh, I goto a "less glorified school" compared to MIT, and study / do research in semiconductor electron migrations, efficiency in cryptograhy systems, implementation of computer based voice and image recognition.

    MIT kids do research in TETRIS.

    wtf? tell me again why MIT is one of the best engineering school again?

    oh wait... i just got it.
  • Online Tetris tournaments (Score:4, Informative)

    by wilbrod (471600) on Friday October 25 2002, @01:38AM (#4527843)
    If you are good at tetris you can play online tournaments at Worldwinner.com [worldwinner.com] against an or some opponents.

    The nice part: you bet real money. If you are somewhat good you can make some cash. I really made 25$,around 37$CDN. I stopped since it was too hard to win when I was classified as "intermediate" and I was loosing all my earnings I won "newbie".

    Try it at your own risk.. Very addictive. You get 5$ free when you join. Everything is VeriSign Certified.
  • by DougJohnson (595893) on Friday October 25 2002, @01:39AM (#4527848)
    Now I can get my Computer Science Theory mark reviewed under the grounds that I put hours of research into attempting to find a solution to an NP Hard problem.

    You'd be amazed at some of the Heuristics you have to use at Level 10!

  • Everybody's a Loser by The Rolling Blackout (Score:1) Friday October 25 2002, @01:42AM
  • NOW I'VE GOT MY EXCUSE! (Score:5, Interesting)

    by fireboy1919 (257783) <rustyp@@@freeshell...org> on Friday October 25 2002, @01:42AM (#4527860) Homepage Journal
    Now whenever I lose the latest new game I can just say, "I have just determined that this game is very hard. Its NP-Hard, in fact." I'm sure that'll impress all the lady-geeks around that would otherwise have thought me intellectually inferior for losing the game.

    Interesting thing about NP-hard stuff, though, especially when it comes to things like video games. There are a group of techniques that work to solve NP-hard problems SOME of the time based around searching. Because there are multiple winning solutions for Tetris, and there is are several quite obvious heuristics to aid in the search (such as planning so that you leave indentations that will fit the next piece(s), and attempting to fill lower lines before higher ones), it's probably still solvable in polynomial time MOST of the time.

    Of course, solvable is relative. The optimal solution (highest score) for a finite number of moves cannot be proven without trying all combinations of states, but to simply finish, there are lots of solutions.
  • My theory (Score:5, Funny)

    by Jugalator (259273) on Friday October 25 2002, @01:42AM (#4527863) Journal
    Tetris wouldn't be NP-hard if it just released that damn 1x4 brick when you need it!
  • Oh come on.. by The Creator (Score:1) Friday October 25 2002, @01:45AM
  • memory optimization by fat32 (Score:2) Friday October 25 2002, @01:46AM
    • Wha...? by Find love Online (Score:1) Friday October 25 2002, @03:27AM
  • researchers by clockwise_music (Score:1) Friday October 25 2002, @01:51AM
    • 1 reply beneath your current threshold.
  • Obligatory Teris link... by ChristW (Score:1) Friday October 25 2002, @01:58AM
  • what about columns? by austad (Score:2) Friday October 25 2002, @01:59AM
  • Wait a second... (Score:5, Interesting)

    by Chemical (49694) <<moc.liamtoh> <ta> <0002relssekn>> on Friday October 25 2002, @02:00AM (#4527918) Homepage
    A lot of Tetris and Tetris type games had a two player mode that had the option for CPU controlled player two if you didn't have any friends. If you set the AI to the maximum level, you would be instantly crushed no matter how good you were. The CPU could instantly decide where to place the blocks, and never made a bad move. Try setting Tetris Attack for the SNES to play against itself for a while. It's kind of impressive.

    My question is this: How is it Nintendo et. al. can program an incredibly skilled Tetris AI, but scientists at MIT cannot?

    • Re:Wait a second... by Crispin Cowan (Score:1) Friday October 25 2002, @02:22AM
      • Re:Wait a second... (Score:5, Informative)

        by travd (608286) on Friday October 25 2002, @02:43AM (#4528017)
        But since there are only 4 blocks in each piece, "exponential" is not that big, the computer can easily compute an optimal placement without breaking a sweat.

        That's just wrong.

        If you read the article, you would see that the fact that tetrominos (that's what they call 'em) are four block combinations does not define the magnitude of the (likely, assuming P != NP) exponential relationship. In fact, they show that the problem scales in an NP fashion with the number of pieces - the number four doesn't come into it.

        What the Nintendo version shows is that a simple AI (with perfect movement abilities) and so on can come close enough to optimal in a usual situation (the article presenet an extremely contrived worse case scenario) to beat a human player. This has no bearing on the NP completeness of the problem.

        On another note, the authors admit that the Tetris problem is NOT NP-Complete except for arbitrarily large game fields.

        [ Parent ]
      • 1 reply beneath your current threshold.
    • Re:Wait a second... (Score:5, Insightful)

      by cosyne (324176) on Friday October 25 2002, @02:32AM (#4527987) Homepage
      My question is this: How is it Nintendo et. al. can program an incredibly skilled Tetris AI, but scientists at MIT cannot?

      First, a disclaimer- IHNRTFA. But still, my guess is that the optimal solution is NP-hard. That is, given the exact sequence of blocks, give the sequence of moves which will get rid of them all as fast as possible and/or with the highest score possible. If you just know the current piece, you have about 48 moves to evaluate (assuming it's like 12 blocks wide and there are 4 possible rotations). If you know the next you have 48^2, but even an NES could probably evaluate those faster than you could given some simple cost function. A lot of computer science is coming up with approximations which are close to optimal (ie they beat humans or at least don't pile up and die) while remaining computationally feasible.
      [ Parent ]
    • Re:Wait a second... (Score:4, Insightful)

      by Patrick (530) on Friday October 25 2002, @09:27AM (#4529534)
      How is it Nintendo et. al. can program an incredibly skilled Tetris AI, but scientists at MIT cannot?

      1) The Nintendo AI doesn't have to be optimal. It just has to be better than a human.

      2) Being better than a human at Tetris is less about placement than it is about agility. You may be better at figuring out where pieces should go, but the Nintendo will always be better at actually getting them into place.

      3) The problem Nintendo solved is much more tractible because it only deals with two pieces at once. The problem MIT posed deals with the entire sequence, potentially hundreds of pieces. The problem is (probably) exponential, so each additional piece that must be considered makes the problem about 20x harder.

      [ Parent ]
    • Re:Wait a second... by kisrael (Score:2) Friday October 25 2002, @09:34AM
    • 3 replies beneath your current threshold.
  • Thoughts... by superdan2k (Score:2) Friday October 25 2002, @02:04AM
    • 1 reply beneath your current threshold.
  • the second I read the article by ferrocene (Score:1) Friday October 25 2002, @02:09AM
  • Historical value by Dexter77 (Score:2) Friday October 25 2002, @02:09AM
  • Duh (Score:3, Informative)

    by Crispin Cowan (20238) <crispin AT crispincowan DOT com> on Friday October 25 2002, @02:15AM (#4527947) Homepage
    Well, duh. Tetris is based on bin packing [gsu.edu], a classic NP-hard optimization problem. That's what makes it such a compelling game: you have to solve a really hard problem in real time.

    Crispin
    ----
    Crispin Cowan, Ph.D.
    Chief Scientist, WireX Communications, Inc. [wirex.com]
    Immunix: [immunix.org] Security Hardened Linux Distribution
    Available for purchase [wirex.com]

    • Re:Duh by donutello (Score:3) Friday October 25 2002, @02:52AM
    • Tetris Crypto by rjh (Score:2) Friday October 25 2002, @04:47AM
    • 3 replies beneath your current threshold.
  • Remember what WOPR said... by jonblaze (Score:2) Friday October 25 2002, @02:22AM
  • Not your father's tetris... (Score:5, Informative)

    by travd (608286) on Friday October 25 2002, @02:24AM (#4527972)
    The top of the third page, the authors reveal a major change to the definition of Tetris they made in order to prove NP-Completeness:
    It is natural to generalize the Tetris gameboard to m-by-n, since a relatively simple dynamic program solves the case of a constant-size gameboard in time polynomial in the number of pieces.
    Of course every version of Tetris that I have played has been on a "constant-size game board" - and so the real result is that Tetris, as the rest of the world knows it, is NOT NP-Complete, and is solvable in P(n) time - I find that the generalization to m x n gameboards breaks the problem, while the other simplifications or generalizations they introduce are reasonable.
  • Tetrisphere? by Ziviyr (Score:2) Friday October 25 2002, @02:25AM
  • Minesweeper too? by sahala (Score:1) Friday October 25 2002, @02:28AM
    • 1 reply beneath your current threshold.
  • Tetris NP-hardness results (Score:5, Insightful)

    by po8 (187055) on Friday October 25 2002, @02:31AM (#4527985)

    Technically, it's 'NP-hard,' meaning that there is no efficient way to calculate the necessary moves to "win"

    It is more correct to say that "there is no known efficient way to calculate the necessary moves to win, and it is unlikely that one will be discovered." Technically, there is no efficient method unless P = NP. See Garey and Johnson [amazon.com] for details.

    At least there's one geek classic that refuses to fall to the scrutiny of mathematicians.

    Actually, even the (surprising, novel, and cool) approximation results only tell us about the asymptotic complexity of the game, and then only of the "offline" game in which you know the sequence of pieces that will be coming. Note that optimal restacking of blocks is also asymptotically NP-hard and inapproximable [Gupta and Nau], but quite tractable for humans and machines even for very large stacks in practice. Short version: in spite of these results, a good AI programmer can easily build a Tetris-playing program that will kick your sorry human behind :-).

    One assumption in the paper that I disagree with is that "intuitively" the offline version (full knowledge of piece sequence) should be easier than the version in which the piece sequence is not known. My intuition says the opposite: in the online version, the most one can do is optimize one's probability of a win. This more modest goal should be easier to attain than the loftier goal of "prove a win if one exists".

  • technically, that is wrong by g4dget (Score:2) Friday October 25 2002, @02:34AM
  • "classic" games and computability by sahala (Score:1) Friday October 25 2002, @02:35AM
  • 0-1 Knapsack Problem by Citizen of Earth (Score:2) Friday October 25 2002, @02:35AM
  • All this talk of tetris by danny256 (Score:1) Friday October 25 2002, @02:42AM
  • Thats sweet by Binarybrain (Score:1) Friday October 25 2002, @02:44AM
    • 1 reply beneath your current threshold.
  • Tetris is hard? by TekReggard (Score:1) Friday October 25 2002, @02:47AM
  • Actualy, it's NP-complete. by Find love Online (Score:1) Friday October 25 2002, @02:51AM
  • by po8 (187055) on Friday October 25 2002, @02:52AM (#4528039)

    Uh, I was just reading the full paper and came to this comment which summarizes an important fact omitted in the abstract:

    An essential part of our reduction is a complicated initial gameboard from which the player must start. A major open question is whether Tetris can be played efficiently with an empty initial configuration: What is the complexity of Tetris when the initial gameboard is empty?
    In other words, "normal offline Tetris" (whatever that means) may still be in P. (And, BTW, when they say "complicated", they really mean it: check out the full paper for details.) Sigh.
  • Too much math nowadays by MalleusEBHC (Score:1) Friday October 25 2002, @02:54AM
  • Tetiris / Eyeball RSI Warning (Score:5, Interesting)

    by Boss, Pointy Haired (537010) on Friday October 25 2002, @02:56AM (#4528053)
    Just a warning to those becoming or already hooked on Tetris.

    I used to be a serious Tetris junkie, and played on many different versions on different platforms.

    Playing so much, I became "quite good", and this meant that blocks were falling extremely rapidly.

    To play tetris at high speed, you glance very quickly at the arriving piece, then move your gaze back to the pile to asses the position - moving the piece without looking at it. Repeat until bored.

    Then my eyes packed up. I basically developed something like "RSI" in both eyes - my eyes would twitch repeatedly up and down in the exact movements used in high speed tetris. This whilst not even playing tetris.

    I diagnosed the problem myself and quit playing, but it took a few months to clear up.

    Just a warning. I still play it on and off.
  • Tetris@home will solve the puzzle by flowerp (Score:1) Friday October 25 2002, @03:07AM
  • by Ektanoor (9949) on Friday October 25 2002, @03:11AM (#4528089) Journal
    Some have noted that women have always had a peculiar taste to play Tetris. It is interesting to note that the most fanatic players are usually women... Well, I am completely of a different mind and always considered this game as too boring. I wondered how could people play such thing for long hours. No more. I consider the game an excellent testing system. The next time I see a girl dealing with NP-hard algorithms and crying she can't hold up, I'll play the dirty trick:

    New fresh roast student - "Excuse me, but this task it's too hard for me. It deals with a NP-hard task and I don't have the brains for it... Couldn't you give a more simple task for me?.."

    Me - "Well go and play some Tetris while I think how we can ease your work..."

    After a few hours - "Well what's the score? And you say NP-hard algorithms are too hard for you? You trying to solve a NP-hard algorithm for more than an hour! Cool, go and try to do the same with that task you don't have brains for..."
    • by tswinzig (210999) on Friday October 25 2002, @08:19AM (#4528967) Journal
      The next time I see a girl dealing with NP-hard algorithms and crying she can't hold up, I'll play the dirty trick...

      And here I thought the rest of your story would involve the use of the pickup line, "Hey baby, wanna play with something that is very NP-Hard?!"

      [ Parent ]
    • 1 reply beneath your current threshold.
  • It's been known for a long time by M3wThr33 (Score:1) Friday October 25 2002, @03:26AM
  • Not Impressed by domcamus (Score:1) Friday October 25 2002, @03:30AM
  • by Stephen (20676) on Friday October 25 2002, @03:39AM (#4528149) Homepage
    It's also the case that Tetris is unwinnable against a malevolent machine, which chooses a nasty sequence of pieces. In the sense that even if you know the pieces in advance, you will eventually fill any tower of finite height.

    I've seen two independent proofs of this (and other people have surely done it too) but I can't find an online proof. But I think that one way for the machine to win is to drop S and Z pieces in any irrational proportion.
  • by delphi125 (544730) on Friday October 25 2002, @03:42AM (#4528153)
    A long time ago, Tetris for the PC printed different coloured spaces for the blocks. Unfortunately, a Hercules monochrome card pretending to be able to deal with colour would display them all the same. So I could see the score etc, but not the pieces themselves. Since that would be a little too hard, I wrote a TSR which hooked into INT 10 which would change spaces to other characters. This depended on the colour, so for example the Blue 2x2 would print as 4 'O's.

    How can this be easy, you ask? Well, I put a delay in there too, it was adjustable from the command line of the TSR. When my score went past -32768 at the highest level, I decided enough was enough, and I didn't play Tetris for many years after.

  • by Keev (573393) on Friday October 25 2002, @03:47AM (#4528166)
    Some little-known related references: A CS student at Univ of BC, John Brzustowski, did his Master's thesis on the problem of winning at Tetris if the computer is aware of your moves and reacting to them. He apparently proved that there is a finite sequence of tetrominos, which, if the machine selects them, you must lose. His work is cited in this later paper by H. Burgiel called "How to Lose at Tetris", which proves more generally that the computer can always produce a sequence of lose-forcing tetrominos, whether or not it's aware of your moves: paper is here [nec.com].
  • Oh by LS (Score:2) Friday October 25 2002, @04:03AM
  • by olethrosdc (584207) on Friday October 25 2002, @04:12AM (#4528232) Homepage Journal

    Pay attention to page three: It is natural to generalize the Tetris gameboard to m-by-n, since a relatively simple dynamic program solves the case of a constant-size gameboard in time polynomial in the number of pieces

    I guess this means that hey, they are talking about something else that the normal constant-size gameboard!

    Also, page 25, gives a subtle hint that this is not about standard Tetris:

    What is the complexity of Tetris for a gameboard with a constant number of rows?

    What can we say about the difficulty of playing online Tetris if pieces are generated independently at random according to the uniform distribution?..

    Also, the authors concentrate on playing optimal with respect to the number of lines cleared and the number of tetrises achived (either objective, not both) - and do not concentrate on, say, not losing (They give references to the hardness of not losing in the first chapter)

  • Encryption by minkwe (Score:1) Friday October 25 2002, @04:14AM
  • Tetris with physics: Triptych (Score:4, Interesting)

    by Plug (14127) on Friday October 25 2002, @04:50AM (#4528304) Homepage
    Chronic Logic [chroniclogic.com], the people who brought you the cool Pontifex bridge builder game, have a game called Triptych, which can loosely be defined as 'Tetris meets Columns with physics'.

    When you drop blocks, gravity affects them, and you can move blocks around with other blocks. (If your blocks aren't placed square, they don't land square! V shaped blocks tend to sit upside down etc) You get rid of blocks not by making lines, but by getting 3 of the same colour in a row, which then 'energize' and let you eat other blocks of the same colour.

    And the best part - it's written in the Simple DirectMedia Layer [libsdl.org], so it runs on Windows, Mac or Linux. Check it out [chroniclogic.com]. (The main site is in Flash; this site takes you straight to it.

    (Disclaimer - I am nothing to do with Chronic Logic - I just like the game.)
  • NP-Hard? by chickenmonger (Score:2) Friday October 25 2002, @06:00AM
  • by MattRog (527508) on Friday October 25 2002, @06:43AM (#4528520) Homepage
    but that doesn't give them the right to flat-out make up words. "Inapproximability" indeed!
  • Actually, Tetris is impossible (Score:4, Informative)

    by watanabe (27967) on Friday October 25 2002, @07:04AM (#4528588)
    Actually, Tetris is impossible.

    http://www.math.uic.edu/~burgiel/Tetris/explanatio n.html [uic.edu] Has a great article about this. Essentially, in a truly random Tetris game, getting a long sequence of alternating Z and S pieces will make it impossible to complete the board; they're thicker in the middle than the sides, meaning you'll build up a little tower in the middle, no matter how good you are.

    The page has links to a version of Tetris with only those pieces, if you want to try your luck on it.

  • P vs. NP and why should I care? (Score:5, Informative)

    by rtos (179649) on Friday October 25 2002, @07:05AM (#4528593) Homepage
    [I posted this before, but I thought it was apropos to this story as well.]

    Perhaps you are wondering what an NP-complete problem is or what this P vs. NP stuff is all about. You might want to check out the comp.theory FAQ [cs.unb.ca] and scroll down to 7. P vs NP. It gives a bit of history and a decent description.

    Or check out The P versus NP Problem [claymath.org] at Clay [claymath.org] for a really good description (unfortunately too long to quote here). And lastly, you might want to check out Tutorial: Does P = NP? [vb-helper.com] at VB Helper for a little more info.

    Ok, but what is it good for? The Compendium of NP Optimization Problems [nada.kth.se] is a great place to look for real world examples of NP problems. Including everything from flower shop scheduling [nada.kth.se] [nada.kth.se] to multiprocessor scheduling [nada.kth.se].

    Hopefully that helps. I was very clueless when it came to P vs. NP stuff that always seems to be mentioned on Slashdot. So I took the time to look it up. Now I'm clueless but I have links to share. :)

  • by frleong (241095) on Friday October 25 2002, @07:33AM (#4528717)
    There is a difference between a solution and an optimal solution. The fact that you don't lose doesn't mean that you're getting the best score. Finding the best way to fit a "T" block, for example, is simply much harder than just finding a place to place it.
  • NP Hard/Complete by bwalling (Score:1) Friday October 25 2002, @08:06AM
  • AI: Tetris vs Dr. Mario (Score:3, Interesting)

    by Vegan Pagan (251984) <deanas@earthlink.net> on Friday October 25 2002, @08:10AM (#4528922)
    If Nintendo is to be believed, Tetris is hard for computers and Dr. Mario is hard for humans.

    They published a SNES game with both Tetris and Dr. Mario on one cartrige. I'm assuming both were programmed by the same team, since it let both games run simultaneously.

    In either game you could play against the AI. You could choose the AI player's smarts, piece drop speed, and starting clutter. When I played against the smartest AI in Tetris, and made all else equal for it and me, I could just beat it, especially when starting with a clear field where I guess the player must be most "creative". But in Dr. Mario the AI was nearly perfect! As fast as possible and the best possible moves! Even on top speed and max clutter the AI almost never caved in! And to me, Dr. Mario is a more complicated game than Tetris.

    How could this be?
  • Time Out! (Score:3, Interesting)

    by kiwifr00t (620461) on Friday October 25 2002, @08:35AM (#4529056)
    I'm either missing something or the boys at the MIT lab are thinking too hard.
    Years ago I wrote a program to play tetris and it did just fine! I know because it played directly against the tetris I had on my computer.
    I'll explain how it worked:
    In 1989 I lived in England and had lots of spare time to tinker with my computer (it was an old PC running at 4.77Mhz).
    I thought DOS Tetris was the coolest thing since mini skirts and was also dabbling with TSR programs at the time (TSR = Terminate and Stay Resident). These would let you run one program in the background while another program runs.
    So, naturally, I wrote a TSR program to play Tetris.
    I would start the TSR and then start the game. The TSR would look in the video buffer and analyze tetris as it ran. It would look at the layout of the board and look at the next piece. With some relatively simple logic and a series of rules it weighed the merits of various positions for the piece. To make the move it would stuff keystrokes in the keyboard buffer, such as Rotate, Rotate, Left, Left, Left, Drop. Then it simply waited till the keyboard buffer was empty (the piece had been moved) and look for the next piece.
    I could just sit back and watch...
    At first it wasn't very good but with some tweaking of rules it improved drastically.
    It would do much better than I could do manually, with pieces spinning, moving and dropping like crazy until the game really sped up. Then, with the limitations of a slow computer it couldn't analyze the best move and get the keystrokes in the buffer in time. Once it hit this threshold the pieces would start to stack up and it would be 'game over'.
    I think at the time and the version I had I personally could get a score of around 8000. The TSR could get scores up to around 15000.

    Just something to think about.....
    --
    Geoff
    • Re:Time Out! by cpeikert (Score:2) Friday October 25 2002, @02:04PM
  • But this doesn't explain why... by diogenes57 (Score:2) Friday October 25 2002, @09:08AM
  • Soko [AI vs human enjoyment] by Derwen (Score:2) Friday October 25 2002, @09:18AM
  • Tetris is for wussies by Reziac (Score:2) Friday October 25 2002, @10:06AM
  • New Deep Fritz competition? by phorm (Score:2) Friday October 25 2002, @10:11AM
  • NP-Hard vs. NP-Complete... by LambSpam (Score:1) Friday October 25 2002, @10:40AM
  • 128-bit Tetris encryption (Score:4, Funny)

    by c64cryptoboy (310001) on Friday October 25 2002, @10:59AM (#4530225) Homepage Journal
    Now that we know it's NP hard, lets see if anyone can come up with a Tetris-based encryption scheme. Lets see, with just one shape (7 tetrominoes with rotations) there are 19 possibilities, so that's at least 4 bits of entropy right there.
    This could make the Bovine distributed cracking clients a lot more fun to watch.
  • Similar to Go? by Suppafly (Score:2) Friday October 25 2002, @11:04AM
  • Harder and More Fun! - Triptych! by teamhasnoi (Score:2) Friday October 25 2002, @11:47AM
  • I am good at Tetris, what does that mean? by Perception (Score:1) Friday October 25 2002, @12:43PM
  • I can't believe it's not Tetris by terrab0t (Score:2) Friday October 25 2002, @12:55PM
  • ouch... my head by emilami (Score:1) Friday October 25 2002, @05:14PM
  • Quarter Eaters by I kan Spl (Score:1) Friday October 25 2002, @07:12PM
  • What this proof is really about (Score:3, Informative)

    by vlad_petric (94134) on Friday October 25 2002, @08:12PM (#4534797) Homepage
    Dear slashdotters who either never took or just completely ignored an algorithms/complexity class,

    They have shown, by reducing one NP-Complete problem to Tetris with full-lookahead, that optimal Tetris with full-lookahead is NP-hard.

    Now, the reducing works by taking any instance (i.e. input) of the original problem and converting it into an instance of the tetris problem, not the other way around. So the conversion won't produce all possible Tetris games, in fact only a very restricted class of them.

    This ignores two important aspects of Tetris playing:

    The game is not bound by the number of pieces (so suboptimal behaviour is not really a problem)

    The game is played with *random* input sets

    But, as always, it's very easy to discuss something that you have no idea what it means. And, btw, being NP-complete or NP-hard doesn't mean necessarily exponential complexity (neither P=NP nor PNP have been shown).

    The Raven

  • 3d Tetris? by rajendran (Score:1) Friday October 25 2002, @11:17PM
  • baduk, dammit by strombrg (Score:1) Tuesday October 29 2002, @04:33PM
  • Re:The answer you seek by papasui (Score:2) Friday October 25 2002, @01:33AM
  • Re:What? (Score:5, Informative)

    by mizhi (186984) on Friday October 25 2002, @01:38AM (#4527840) Homepage
    Because games can provide real world analogues. Yeah, I'm going to invoke Nash and his game theory. When he was studying at princeton, a large portion of the mathematicians there played games, some of which were invented at princeton based on some mathematical notion of some sort. Lots of those dumb little puzzles that you see in hobby shops have rigorous mathematical treatments. Moreover, a classic problem in computer science is to reduce one problem to another, so imagine taking a real world problem and modeling it as a simpler problem with the same characteristics. Say, a game. If you can analyze the game, then you've got at least a suitable starting point for analyzing the real world problem that you're actually interested in. Now, I don't know what practical application that knowing the approximation characteristics of optimizing parts of a tetris game are, but of the cuff I could see it having applications in packing problems or flow control (particles through a pipe?).

    So, to answer your assertion that these studies are getting dumber and dumber by the day, I'd counter that while it may not produce immediate practical results, I could see this analysis being used elsewhere.
    [ Parent ]
  • Re:ending of tetris by \\ (Score:2) Friday October 25 2002, @01:41AM
  • Re:Hrm. (Score:3, Funny)

    by Anonymous Coward on Friday October 25 2002, @01:42AM (#4527862)
    Are there any other NP-hard games which were invented by dead Russians?

    Can't you be satisfied with one? I mean do you have any idea how hard it is to get dead Russions to invent anything?
    [ Parent ]
    • Re:Hrm. by SkulkCU (Score:3) Friday October 25 2002, @05:02AM
  • Re:ending of tetris (Score:3, Funny)

    by silvaran (214334) on Friday October 25 2002, @01:46AM (#4527874)
    Your mother could beat you at Tetris? Boy, were you in the wrong generation.
    [ Parent ]
  • Re:Because the game is hard, or... (Score:3, Informative)

    by McBeth (1724) <[gro.sggorb] [ta] [htebcm]> on Friday October 25 2002, @02:04AM (#4527926) Homepage
    Read the article, it is amazingly accessible.

    Humans and NP problems
    There are two things people look at when they find a new NP problem. First is reducing a currently known NP problem to the new problem. In this case, they reduced the 3 bucket problem. Second is the difficulty of approximation. Apparently Tetris also happens to be difficult to approximate. Humans happen to be _really_ good at approximation, while sucking at exact calculations. That is the whole reason we designed computers in the first place.

    Note for those who don't read the article. Their proof is _not_ for a basic tetris game. They assume a prebuilt structure that you are trying to fit pieces into. This structure is designed to allow the mapping from the 3-bucket problem to Tetris. They specifically mention the starting point of an empty board as an open problem.
    [ Parent ]
  • Re:ending of tetris by feceus (Score:2) Friday October 25 2002, @02:14AM
  • Re:Interesting Reduction by pyrote (Score:2) Friday October 25 2002, @02:16AM
  • Re:Hrm. (Score:5, Informative)

    by Wrexen (151642) on Friday October 25 2002, @02:20AM (#4527960) Homepage
    The inventor of Tetris is alive and well. In fact, I just saw him give a talk while visitng UIUC [uiuc.edu] at their Reflections and Projections conference.
    [ Parent ]
  • Re:Because the game is hard, or... (Score:5, Informative)

    by sahala (105682) <sahala@gm[ ].com ['ail' in gap]> on Friday October 25 2002, @02:25AM (#4527974) Homepage
    ... because object recognition is hard for computers? Tetris is all about putting things where they fit, not some grand master strategy. And us biological constructs have an advantage, where we can more or less decide on the fly if X piece will fit decently enough in Y hole without having to go through a bajillion IF-THEN logic loops.

    How is this modded up as insightful??? Object recognition has nothing to do with this being hard. Read what it says on the bottom of page 2:

    Our results. We introduce the natural full-information (offline) version of Tetris: we have a deterministic, finite piece sequence, and the player knows the identity and order of all pieces that will be presented. We study the offine version because its hardness captures much of the difficulty of playing Tetris; intuitively, it is only easier to play Tetris with complete knowledge of the future, so the difficulty of playing the offine version suggests the diffculty of playing the online version. It also naturally generalizes the one-piece lookahead of implemented versions of Tetris.

    [ Parent ]
  • by Find love Online (619756) on Friday October 25 2002, @03:22AM (#4528115) Homepage
    Tetris is all about putting things where they fit, not some grand master strategy.

    Actually, Tetris is all about risk management. See my other post on the subject. Once you get good at fitting the pieces together, the game becomes a question of figuring how risky building (and destroying) certain structures is, based on the probability of getting a long, or L shape.

    And us biological constructs have an advantage, where we can more or less decide on the fly if X piece will fit decently enough in Y hole without having to go through a bajillion IF-THEN logic loops.

    Hrm... What is an "if-then" loop?

    Seriously though, in this case it shouldn't take more then a handful of loops and conditionals to figure out if a piece fits somewhere.

    Playing Tetris is not actually a hard problem for a computer. NP-Hard and 'hard for a computer' are totally different things.

    In general, the only reason human brains are better at some kinds of problems then computers is because computers are simply more limited in processing power. It would take thousands upon thousands of PCs hooked together to equal one human brain in terms of raw processing power.

    (I've heard estimates that PCs will equal the human mind in 20 years, figuring with Moore's law, that would mean the human brain is about 2^13 times more powerful then a PC, or 8192 times)

    Computational theory applies to all computing devices, including brains and other neural networks.

    If something is NP-hard for a circuit, its NP hard for a brain too.
    [ Parent ]
  • Re:ending of tetris by joss (Score:2) Friday October 25 2002, @04:56AM
  • Re:Hrm. (Score:5, Funny)

    by 6Yankee (597075) on Friday October 25 2002, @05:18AM (#4528362)

    Are there any other NP-hard games which were invented by dead Russians?

    Is Russian Roulette NP-hard?

    [ Parent ]
    • 1 reply beneath your current threshold.
  • Whoever downmodded me don't know science by Jeppe Salvesen (Score:1) Friday October 25 2002, @06:24AM
  • 30 replies beneath your current threshold.
(1) | 2