All the Best Games May Be NP-Hard
Catullus writes "Following in the footsteps of Tetris and Minesweeper, the simple yet addictive multiplatform game Flood-It is the latest puzzle to be proven to be hard — NP-hard, to be exact. This means that there's no way to write an efficient program to beat the game, unless P=NP. This research by computer scientists from Bristol University raises the intriguing question: are these games fun precisely because they're hard for computers to solve, and need a spark of human creativity?"
I'd say that this is most definitely NP, for humans and AI alike.
UNIX? They're not even circumcised! Savages!
Tetris, to me, is the ultimate video game. It can be played by anyone ranging from someone who doesn't even know what a video game is all the way to competitive level hardcore pros.
No other video game in history has that kind of audience. The fact that, although variations on the original have been released, the most popular version is still the original version (which has remain mostly untouched throughout its existence) just gives more credit to its simplistic genius.
Living With a Nerd
Well, they are stories.
Because it is tagged so automatically.
FYI, Sokoban is NP-hard as well (according to wikipedia). I'm seeing a pattern here...
An essentially identical game, Drench, is available as a Flash game at Flash by Night.
Since I had to suffer through at least one professor who didn't understand basic complexity theory last night, and I know that Slashdot generally screws it up to.
NP-Hard means that there's no (deterministic) polynomial-time algorithm to solve the games. Additionally, you always have to generalize these games in order to make that claim. Since computational complexity is defined in terms of the length of the input, and certainly all of these games are being played on an input of fixed length.
However, there are effective approaches to solving NP-Hard problems. There are solvers for known NP-Hard problems. If you Google "sat solver" you'll find at least 5 that you can just download. SAT solvers are used in VLSI validation and other practical things. These solvers use heuristics to improve search performance, generally proposing answers and checking them (for NP-Complete problems).
Also, there are tons of games known to be NP or PSPACE complete. The reductions for those games are kind of a standard problem, since the AI community writes a bunch of these solvers.
sorry to burst your bubble, but there are many poly-time approaches to solving NP-hard/complete problems that are "good enough" for many purposes. and vice versa - many (most? all?) problems that are poly-time, humans solve using heuristics that lead to often sub-optimal solutions. so what exactly is new here?
weinersmith
Probably because like any other good problem, they both offer a problem and they help start the solving process.
Non impediti ratione cogitationus.
the conclusion drawn is pretty much one that you're taught in basic-level game theory. If its easy to solve, nobody wants to play it
Just because you're paranoid doesn't mean they aren't out to get you
so where is the pattern?
Sufficiently large search space makes it possible to invent a heuristics suitable for the personality of the player. This way the game becomes a way of self expression and continual reinvention.
Because they are made from recycled tacos?
NP-hard just means you (most likely) need an exponential search. Maybe you want to take this as evidence that human creativity is needed, but that's a stretch. Humans don't do better than computers on NP-hard problems. In fact, they almost certainly do worse, because if you cannot skip the search part, computers are tremendously faster at that. See how quickly a human solves a sudoku, vs. a computer. Even though it's NP-hard (for arbitrary dimensions).
Of course the whole thing depends on the base of the exponent. It's true that many hard problems are hopeless for computers while humans do detect some patterns and make some progress. (E.g., searches for mathematical proofs.) But the games listed have pretty well-defined, fairly small search spaces.
Plus, the proof for NP-hardness is for arbitrary sizes, not the usual dimensions that humans play the game at. Computers are hands down better at that.
are these games fun precisely because they're hard for computers to solve, and need a spark of human creativity?"
No. The human mind is created by the brain which is governed by the laws of physics. The laws of physics are mathematical, so fundamentally the human mind is an algorithm. Because of Turing completeness, there's fundamentally nothing that the human mind can do that a computer cannot. It's not easier for humans to solve NP-hard problems. We just come with better software for it.
Give me Classic Slashdot or give me death!
Part of "fun" is uncertainty, a sense of challenge and the subsequent realization when you succeed, when there is no threat to more basic needs. Such feelings would be lessened if solving the problem was a sure thing (or if on the other extreme it looks unlikely to solve, but that's off the topic), and that's why we pick games/levels according to our skill.
Indeed, to me Minesweeper quickly becomes boring, since most of the clicking obeys pretty simple rules ("2-3-2 along an edge - that's clear-3mines-clear"); then at the end it often becomes undecidable and it's eeny-meeny-clicky-boom.
This post contains no rudeness or derision of any kind. All arguments are friendly. Terms and exclusions may apply.
What does this say about WoW, if it can be played quite successfully by a bot?
Cynicism, like dogmatism, can be an excuse for intellectual laziness. - Susan Shirk
Plug equals Not Play?
What? The game can be theoretically played forever on an imperfect generator as long as you don't hit an endless stream of Z and S blocks. It's possible to roughly categorize the blocks and sort them efficiently as they come, perpetually lining up for a full Tetris every time a line comes down. Every piece that shows up has a computationally obvious columnar location under this strategy, but orientation is still obvious but less naively computable; it's pretty boring to play that way though.
Support my political activism on Patreon.
Why is every story tagged story? The answer is in your question...
Look, I'll fire up a few smokes and toss back a cold one and sort out this whole P=NP problem for you.... I'm sure that I can come up with it right away... how hard can it really be? Tongue firmly in cheek!
This is my sig.
There is a fun book on this topic called "Games, Puzzles and Computation" by Hearn and Demaine that is well worth a read if you're interested in puzzles or complexity.
The generalizations of both games are NP-Hard. They're only constant time because of the fixed number of pieces and places for those pieces to go.
I think you're underestimating the difficulty of these games. They are definitely np-hard (actually a bit harder even)
http://www.ics.uci.edu/~eppstein/cgt/hard.html
It seems to me that earning the title of being NP-hard is very easy for games. As someone said before, even sudoku is NP-hard, but intuition-less computers are still much faster at it than humans with all their intuition. So where is the list of the "boring" games that aren't NP-hard? If there aren't any such games, then this story is pretty trivial.
Chess and Go are actually EXPTIME-complete, even harder than NP-complete problems and PSPACE-complete problems.
In general, one-player games of bounded length (like Flood-It, or Sudoku) tend to be NP-complete; one-player unbounded games (like sliding-block puzzles, or Sokoban) tend to be PSPACE-complete; two-player bounded-length games (like Hex, or Amazons) also tend to be PSPACE-complete, and two-player unbounded games (like Chess, Checkers, and Go) tend to be EXPTIME-complete.
I can't resist here a plug for my book (with Erik Demaine), Games, Puzzles, and Computation, which discusses all these issues in detail. A theme running throughout the book is the same as the view expressed in this paper: most interesting games and puzzles seem to be as hard as their "natural" complexity class, outlined above.
I already wrote a solver for this exact game. It just isn’t efficient.
Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
I do not know about anyone else, but I never really got how anyone considered these games fun.
Troll is not a replacement for I disagree.
I think discussing your new iPhone game on slashdot is an NP-Easy way to get a substantial popularity boost.
whenever I play Tetris I grow tired of it rather quickly (less than half an hour).
That's why new versions of Tetris take five minutes to play through: either they're two- or three-minute time trials, or they speed up so fast that you're dead after 5 minutes. Watch this video all the way through.
Not a chance, you can play it half asleep without a single thought, just as easy as writing or talking. I've written a relatively simple algorithm for a computer to play tetris, it enumerates all possible options of placing a piece and compares certain properties of resulting landscape (number of holes, smoothness of surface, etc). Of course it is not perfect, but it can easily outplay most human players without any problems.
I don't get why people talk about NP hard in games that generally have fixed-sized worlds. The whole point of complexity in computer science is to talk about how an algorithm can scale up with N, but when N is fixed I would argue that the algorithm's complexity doesn't even matter; it is fixed for that game.
For example, who cares if an AI takes 10x longer every time you add 1 to the width of a tetris world? 99.999% of people play on a 10x20 board. When I hear someone say "blah" is NP hard, I always ask "what is N?" You'd be amazed how many people can't answer that question.
Also, calling games like these NP-hard misses the more important point of how good heuristic algorithms are, which is the way most humans and current AIs attempt to solve them. A game is not more fun because is it NP-hard, it is often more fun because finding, learning, and applying the heuristics on the game is fun.
At least why can't game designers stay away from the "problem" colors like reds/greens, blues/purples etc.??
I must inquire when it is that one is given the "competitive level hardcore pro" title in Tetris?
Usually that happens once you get into the 8000s on Tetris DS or you can get M in Master or Death on TGM2+. Then you get to the tournament (i.e. "competitive level") and find that this ni**a can still steal your colour. Two places where the hardcore players hang out are harddrop.com and tetrisconcept.net.
Math, math, blah, blah. Post your record people.
24 turns, but I'm a beginner.
It is another way of saying “Easy to Learn, Hard to Master” .
If a game with simple rules poses a problem that is complicated enough so that you can't find a trivial solution, that is half way to have a fun game.
There are other aspects like some randomness, enough to create variety but not to make it a luck game, etc...
Get me a kindle version of that book and I'll consider purchasing it!
Well, I think in the end he means something more along the lines of "why is the story tag visible on the front page". I find it annoying too sometimes.
which is totally what she said
Indeed, to me Minesweeper quickly becomes boring, since most of the clicking obeys pretty simple rules ("2-3-2 along an edge - that's clear-3mines-clear"); then at the end it often becomes undecidable and it's eeny-meeny-clicky-boom.
That's when you start playing games that slowly solve the boring stuff for you. My own Luminesweeper is one of them: a line periodically sweeps across the screen and solves squares using the single-point method. So it almost feels like you're playing co-op, and the goal is to do as much as you can to promote a healthy alternation between the hard stuff (your task) and the easy stuff (the CPU's task).
I'll mention it to my publisher, but honestly it would lose a lot without all the color figures.
The book is based on my Ph.D. thesis, which you can download for free:
http://www.swiss.ai.mit.edu/~bob/hearn-thesis-final.pdf
Or does the Wikipedia article introduction for NP http://en.wikipedia.org/wiki/NP_%28complexity%29 contradict itself??
It says that NP is the set of decision problems for which the 'yes' answers are verifiable by a non-deterministic Turing machine in polynomial time. Then it goes on to say that NP also includes NP-complete problems, which have no known polynomial-time solution algorithm. So, how come they know NP-complete belong in NP, if there are no known solutions???
This means that there's no way to write an efficient program to beat the game, unless P=NP.
All these games are small finite size in practice, so asymptotic complexity results tell you nothing about how difficult it is to solve them. In addition, the idea that "P = efficient program" is utter nonsense; for large problems, even quadratic complexity is a serious problem. A realistic notion these days is that a reasonable asymptotic complexity for "efficient programs" is no worse than n log^k n for small k. Anything larger than that and it won't scale. The converse is also nonsense. Just because a particular problem is NP hard in general doesn't mean that the problem instances you encounter in practice are hard cases. Furthermore, the assumption that you need to find an optimal solution is also wrong. In fact, in any competitive game, all you really care about is beating the other guy.
P=NP is a neat theoretical issue in computer science, but its practical significance has been completely overstated.
P=N*P
N=1
P! = N * P
(P-1)! = N
(P-1)! = 1
P = 1
Now where in my Nobel Peace Prize.
Knowledge = Power
P= W/t
t=Money
Money = Work/Knowledge so the less you know the more you make
Generalizing chess past an 8x8 board doesn't make a lot of sense, since the number and types of pieces and their initial placement are so integral to the game. Practically the only people who do generalize it are computational theorists. It's like arguing about what football would be like if the field could by 1000 km long.
They're not tagged "tagged" when they're tagged. They're not tagged "english" when they're english. What's the point of tagging an article with "story"? It doesn't aid in any search. It doesn't provide any additional information. It's pointless, so why have it?
When our name is on the back of your car, we're behind you all the way!
I think the kindle can recieve color information, just not display it! At least the kindle app on the iPad seems to be able to.
You know what would be really cool? If you made a digital interactive version of the book, where players can actually see the games progress and maybe even try to play them in the "book!" Probably not justifiable considering all the programming you would need for something like that and the cost of such work.
Just an idea.
If everything is tagged story, then the tag becomes meaningless as a filter. I am under the assumption that someday it is foreseen that there will be a posting that is not a story, and will not be tagged as such (probably will be tagged !story) thus making whoever thought tagging everything as story look like a genius. It's like you have a car dealership, and you are involved in inventory. All you sell is cars, in many shapes, sizes, colors, makes, models, etc. You want to have a database that tracks sales in those categories (where a single vehicle will have values in more than one category). Does it make sense to have a category (let's call it vehicle) that every piece of inventory fits into?
Interesting how Flood-It is a complete rip-off of a much earlier game called "7 Colors" - http://en.wikipedia.org/wiki/7_Colors
They're not even the first ones to make for the iPhone: http://ketara.ca/7colors.html
I like how none of it is ever mentioned.
It's on my list...
No, I think it's just the fact that there are many many more posts submitted as potential stories to the firehose or whatever it's called, and then the ones that are chosen for the frontpage are tagged as stories. Sorry to spoil your hypothesis.
The tag is useful in some cases, but not as a visible entity on the front page. It's about as pointless as tattooing your name on both sides of your face, just in case someone suddenly wonders if you're really you when you turn sideways.
which is totally what she said
Green; red; yellow; red; blue; green...
I once took an excursion to Reddit, and later HN. Unlimited up/down voting sucks when dealing with a hive-mind.
The generalized versions, that is. They are in fact PSPACE-hard, which is even harder than NP-hard (i.e. a Go solver could also solve any problem in NP). The PSPACE-hard problems are a superset of the NP-hard problems. Any PSPACE-hard problem is also NP-hard.
What you were thinking is that they are not *NP-complete*. NP is a certain class of problems, and "Problem X is NP-hard" means "if you have a polynomial-time subroutine that solves problem X, then you can solve any problem in NP in polynomial time by calling the subroutine". "X is NP-complete" means two things are both true: 1) X is NP-hard, and 2) X itself is a member of NP. The NP-complete problems are the hardest problems that are still inside NP, but you can get even harder problems by going -outside- of NP.
That seems to be the situation with Chess and Go: they are NP-hard (this is proven) but they also appear to be so hard that they are completely outside of NP (this is an unsolved conjecture like P vs NP). The defining characteristic of NP is that if you are shown the answer to an NP problem, you can verify it efficiently. Just show the factors of the big composite number; show the sequence of moves that solves the tetris puzzle, etc. Finding the answer is hard, verifying it once you know it is easy.
With chess, you can't do that. Given a complicated chess position that you want to evaluate, maybe the answer is "white is winning", but you can't easily prove that. You can't say "the winning sequence is: white goes here, black goes there, white goes here, etc" because you have to also account for other possible responses of black. Finding the answer is difficult, but verifying the answer after you know what it is, is also difficult.
Look at the firehose and you'll see why the "story" tag makes sense. It's to differentiate the submissions that have graduated.
"Trolls they were, but filled with the evil will of their master: a fell race..." -- J.R.R. Tolkien on Olog-hai
Speaking of Erik Demaine, he has an excellent algorithms course on OCW: http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-046JFall-2005/VideoLectures/
Well worth watching on video!
Some of the lectures (such as the first one) are by Leiserson, but Demaine's are a treat.
tic tac toe.
Chess and Go are actually EXPTIME-complete.
So how much time do I need to spend on XP grinding before I can complete them?
How many users of Windows are there? Approaching 1 billion homes? That's a bigger audience than even the best-selling console (~150 million PS2s) ever reached.
There's always the question of availability vs. how much people actually play it- I don't play Minesweeper much myself personally, but I'm sure a lot of people still do.
At any rate, it reminds me of something I wondered (in the early 2000s) as to whether Nokia's "Snake" game was the most played computer game in the world. Sure, not everyone had a Nokia, but their 3210 et al were one of the most popular phone lines back then, and those that *did* have them probably played that game casually quite a lot.
"Slashdot - News and Chat Sites Deviant". (Click "homepage" link above for details).
If anything, perhaps the issue is simply that some of the non NP-hard games have discernible patterns in them that human players pick up on? For example, I can remember one of my friends who loved console sports games, back when we were all in college. Often, though, he'd buy a new one for Sega or what-not, think it was *awesome* for a while, and then suddenly just quit playing it. His reason was inevitably one of having figured out some pattern that he could always score a goal with - making the game no longer a challenge. Same reason I quit playing Starcraft and several other "resource management" type games.... Once I (or in my case, my opponents) all started figuring out the "optimal" ways to use their characters, it became more a game of following exact patterns of "create this unit, then this and this one as quickly as possible, followed by using first unit to make 4 of these.... etc. etc.". If all players knew the optimal strategies, it boiled down to who clicked with the least "lag time" between clicks, or who made a mistake by mis-clicking. BORING!
I'm sure NP-hard games have an inherent "advantage" in that they're proven not to have such "possible to memorize" strategies to win consistently ... but many other factors determine if they're "fun to play" or not, beyond that. (I know quite a few people who really dislike playing chess, even though it's both NP-hard AND considered one of the "all time great games ever invented". For some folks, it probably just seems too dull and dry. I'm sure that's why they sold so many copies of "Battlechess" years ago. It was still chess, but all the 3D animations and creative "kill moves" when you captured pieces added something the original lacked.)
I see your point, hadn't considered that. But it still seems useless, surely the firehose submissions are separable from those that make it to the front page via another method, but perhaps not one that can or will be exposed in the same manner as tag filtering. But I was just looking for a way to work in a car analogy.
All you have to do is google "cheap game gold"
you will come up with a pretty good list of games in which people will actually pay money to other people in order to have computers play a game for them.
Who has no fucking idea what any of this means, and is only further confused by the wikipedia articles written by nerds who have no communication skills.
Elad Verbin proved that floodit is NP-Hard more than a year ago. See the comments here: http://valis.cs.uiuc.edu/blog/?p=2005".
Check out: http://jasonlind.wordpress.com/2010/03/25/p-np-probably/.
Seems to be in line with the conclusions of this thread.
Yes indeed, they were separate before the tagging system ever existed AFAIK. As for the car analogy.. tagging each story with story is like writing "car" alongside the manufacturer's logo on every car you make ;)
which is totally what she said
Doubt that Tetris being NP-hard matters for the usual player. Ok, I've only played some clone, where you need to rotate/move your current tile to fit in, while it's falling and you also know the shape of the next tile already and can consider that, too.
Due to the time restriction, I doubt that many people do a lot more deep thinking there.
If you had a lot of time for your decision, you'd consider not only the next tile that you already know, but also the possibilities for the following tiles that come after that and all the ways you could rotate and move them to fit in and on that you'd base your decision about how to fit the current tile.
In practise due to the time contraint, I doubt that anyone thinks more than one or two steps ahead.
That stochastic calculation to do the best bet would just be too complex and rather take hours on paper than seconds, I suppose. lol.
Insert traveling salesman problem here. Assume salesman uses a car.
http://en.wikipedia.org/wiki/Tai_Shogi
The only thing worse than a Democrat is a Republican.
Tetris and Minesweeper may be NP Hard, but that doesn't mean a computer program can't beat a human player. Heck, the reaction time alone would make a computer player WAY better at Tetris than a human. Chess is NP Hard under the rules printed on the inside of the lid of most cheap chess sets ("Hoyle rules" -- there are no limits on stuff like how many turns you can go without a capture or pawn move), but computers still easily thrash all but the best human grandmasters.
The category for games that computers aren't smart enough to play as well as a human is "AI Complete". Stuff like Freeciv and Wesnoth, where strategy is subjective, are MUCH harder to write decent AI for than Tetris and Minesweeper.
Cut that out, or I will ship you to Norilsk in a box.
The premise in the OP doesn't make much sense - I don't think a typical instance of Minesweeper is particularly hard computationally, you can generally solve them without having to think more than a few moves ahead. Worst case it is I'm sure, with denser boards particularly. But I don't think the game is enjoyable because it is especially challenging.
Minesweeper is not NP-complete. The "Minesweeper consistency problem" is. It's not the same, solving the game is P (much easier).
I know I did when I was 13 or so. What pissed me off was when I got my second phone: although it was much more powerful and had Snake with colors and a much greater resolution, it could only ran a more or less half the speed the other could, taking away most of the challenge.
Dilbert RSS feed
Here is a vid of my Minesweeper-Cheater program completing the Minesweeper game in about 12 seconds http://www.youtube.com/watch?v=wCGV8jYc3RE
Okay, but in the sense that any of the games in the original submission are NP-Hard, so are Chess and Go.
I want to disagree that Tetris and Minesweeper are the immediate candidates for "Best Games". I've played both, but only about 5 hours each. They are ultra-simple. Compare that to games like Civilization, Knights of the Old Republic, or World of Warcraft, all in the hundreds of hours.
I guess the "problem" with Tetris, Minesweeper, even things like Pac*Man is to me they are way too sparse and limited. Inorganic. They just play like a limited algebra problem with a slightly prettier graphical interface. That comes across as mental busywork to me, emphasis _work_, not play. I perfer games with either more story to them, or else complicated, open-ended strategy that can bloom outwards into choices wider than "Hmm, should I put this piece in column 1 or 8? And if so, which of 4 rotations?" Or "Which X,Y coordinate should I click on next using deductive, sudoku-like reasoning?" I prefer "What is my grand strategy for this next entire phase of the game?"