
Classic Nintendo Games Are NP-Hard (2012) - iamandoni
http://arxiv.org/abs/1203.1895
======
CJefferson
I wondered how this could possibly work, then found this sentence. Basically
their generalisations have to go far beyond what these games are (the NES
mario games had everything be forgotten when you scrolled along).

> For example, recall that in Super Mario Bros. everything substantially off
> screen resets to its initial state. Thus, if we generalize the stage size in
> Super Mario Bros. but keep the screen size constant, then reachability of
> the goal can be decided in polynomial time:

~~~
xigency
Misleading article title and misleading paper title.

------
headcanon
Interesting - I wonder if NP-hardness can be used as a sufficient indicator of
how "enjoyably challenging" a game is. There's a reason these games are such
classics, and I dont think its entirely because of their timing, polish, and
marketing. Miyamoto's games always had that special "something" (opinion, I
know), maybe this has something to do with it?

~~~
canjobear
I had initially thought the same thing, and further that the computational
complexity of a game as defined in this paper might be a metric of how
challenging a game is.

The paper shows that Super Mario Bros. is NP-complete, whereas Zelda games are
PSPACE-complete. So Zelda is more complex than Mario (unless P=PSPACE). Is
there some subjective way in which Zelda is harder than Mario, that would
correspond to the difference? I guess Zelda can feel more cerebral, maybe.

More crucially the proofs in this paper rely just on the availability of
certain items and level configurations that allow them to build circuits to
solve 3SAT or whatever. All the other items and possible configurations in a
game are irrelevant. For example they show Zelda OoT is PSPACE-complete
because it has puzzles where you push around ice blocks---it is possible to
construct such as puzzle where solving the puzzle is PSPACE-complete. All the
other puzzles in the game, and also the configuration of real ice block
puzzles in the game, do not factor into the proof, all that matters is that
ice blocks exist somewhere in the game.

So these proofs might point to a potential hard core of cerebral difficulty in
games but they ignore many other factors which contribute to enjoyable
challengingness. I remember the ice block puzzles in Zelda OoT being pretty
tricky, but they certainly don't stand out as the most memorable part of the
game.

~~~
chongli
I don't think computational complexity classes are any more than an extremely
rough metric for how challenging games can be. Sudoku, for example, is known
to be NP-complete yet puzzles range from the utterly trivial (even to
beginners) to the nigh-impossible for a human mind.

This is all putting aside the other ways in which video games can be difficult
for humans but trivial for computers. Games which emphasize reflexes, timing,
accuracy, communication, etc. are all orthogonal to the question of
computational complexity.

~~~
WorldMaker
Indeed. I'd say there is surprisingly little correlation between computational
complexity and how a human experiences complexity.

A similar example, is that we know that 2-color match-Ns (and some further
generalizations therefrom) such as Tic Tac Toe, Connect 4, and even wilder
variants like Lumines have solved, polynomial solutions and machines can play
them better than humans ever will. Humans will probably play some of these
games forever, and its still a continual surprise to me how many people don't
know the generalized Tic Tac Toe solution, much less that the only way to win
is not to play.

Lumines will probably remain interesting to humans for a long time for those
orthogonal reasons such as timing and accuracy (and music). But the
interesting comparison here is to Tetris which we also generally know to be
NP-hard as a direct relative to the generalized packing problem. I would think
that to a human both games "feel" equally complex and yet in terms of
computational complex you have easy solved algorithm in Lumines and
computationally hard problem in Tetris. Lumines certainly feels at first
glance to a human like an equal to the packing problem, even though it is not.

------
fiatjaf
Can someone explain what is NP-Hard in a few sentences?

~~~
simonsarris
Without using any math terms at all:

Suppose you've got a list of numbers:

    
    
        5, 11, 26, 13, 215, 55, 68, 99, 3, 7, 41
    

And I ask: "Do any of these numbers together add up to 126?

You might have to try every combination of numbers to get an answer. It can be
very slow to do, trying every single combination (imagine a list with
thousands of numbers, and a very long goal number). Maybe there are no
combinations!

But once you have an answer:

    
    
        11 + 13 + 99 + 3 = 126
    

It is very easy to verify that the provided answer is correct (are all those
numbers in my list? Yes, verified!)

Compare that problem to this one: Is this list of numbers in ascending order?

    
    
        4, 7, 11, 22, 6, 35
    

The answer is "No, because of the 6." Finding the answer is much faster
because you can do it on one read-through of the list. You aren't checking a
huge number of potential combinations or anything.

The first problem is in the class of problems called NP-Hard.

Oof. Getting lengthy so I'll shush here. Hope that gives you an intuitive feel
for it.

~~~
fryguy
That's just NP though. NP-hard means that if you have an algorithm that runs
in NP to an HP-hard, you can solve all of them (with a polynomial-time
transformation).

------
tekknolagi
This is my algorithms professor :D Dope!

------
echelon
This seems strange to me. Mario doesn't "feel" NP-hard. I guess I'll have to
read the paper tonight.

~~~
canjobear
Playing the game isn't NP-hard, rather the task of deciding whether a level
can be completed or not is NP hard (in fact, NP-complete for Super Mario Bros.
and PSPACE-complete for Zelda games).

~~~
xigency
Being able to complete a level requires knowing that the level can be
completed.

------
Karunamon
So as someone with only a lay understanding of what NP-Hard means - does
anyone remember that neural network that someone trained to play the game[1]?

So if you can train a neural network to solve an NP-Hard problem, does that
mean by definition (since NP refers to a whole class of problems) that a
neural network could eventually be trained to solve any given NPH problem
given the time and compute resources to do so?

[1]:
[https://www.youtube.com/watch?v=xOCurBYI_gY](https://www.youtube.com/watch?v=xOCurBYI_gY)

~~~
yoavz
If a problem is NP-Hard, it does not mean it cannot be solved. Rather, it
means it cannot be solved efficiently (in _polynomial_ time). Most NPH
problems, now including Mario and 3SAT, can be solved given the time and
compute resources to do so.

~~~
lorenzhs
Well, to be exact, it's an open question whether they can be solved
efficiently or not. The general assumption is that they can't, but it hasn't
been proven yet.

------
newsignup
Why is this even a surprise, people have been participating in AI challenges
for long time (like these :
[http://ants.aichallenge.org/](http://ants.aichallenge.org/) ) and are well
aware that those are hard problems, they develop heuristics since its not
computationally possible to obtain perfect solution.

~~~
autoreleasepool
Genuinely curious - who claimed that this was a surprise?

Side note: The results of research and insights derived thereof are worth
sharing in their own right. It doesn't matter how obvious the result may be to
a certain subset of people.

------
BorisMelnik
big NES fan here, not a low level programmer - can someone ELI5?

------
mtgx
Let's make quantum computers play Nintendo games then.

~~~
lorenzhs
Quoting Wikipedia:

    
    
        BQP is suspected to be disjoint from NP-complete and a strict
        superset of P, but that is not known. Both integer
        factorization and discrete log are in BQP. Both of these
        problems are NP problems suspected to be outside BPP, and
        hence outside P. Both are suspected to not be
        NP-complete. There is a common misconception that quantum
        computers can solve NP-complete problems in polynomial
        time. That is not known to be true, and is generally
        suspected to be false.[82]
    

[https://en.wikipedia.org/wiki/Quantum_computing#Relation_to_...](https://en.wikipedia.org/wiki/Quantum_computing#Relation_to_computational_complexity_theory)

------
alttab
I figured that out when I was 3.

~~~
badloginagain
I thought your comment was funny, and thought "well maybe the downvoters are
being a bit too trigger happy"; but I think it's right to downvote. HN needs
to stay vigilant about the quality of content offered- we've all see the
slippery slope online communities tread on. Please keep comments on-topic and
providing interesting insights to the post at hand. HN will be a better place
for it.

~~~
alttab
Yeah nothing says "off topic" like relating to the topic by agreeing the games
are hard. A little nostalgia never hurt anyone. Instead of letting the
downvotes do the "voting" you had to outline why you did it, contributing to
the off topic discussion. Thanks for "providing interesting insights to the
post at hand." Thanks for making HN a better place.

~~~
badloginagain
I try my best, even if I don't have the ability to downvote. I'm a scrub!

~~~
alttab
I was being sarcastic - I'm not certain your comment helped the discussion at
all. Welcome to HN, I hope you enjoy your stay as long as I have.

~~~
badloginagain
I didn't pick up on your sarcasm at all! So lol!

Although, if by explaining to the original downvoted poster why he was being
downvoted, perhaps the poster will post more constructive comments in the
future.

Maybe the opposite happened, and I merely contributed to an off-comment thread
and dragging the OP and the HN community in general down with me.

I don't have the metrics, so no one can tell for sure, which means I'll defend
with viscous hostility the belief that I am right.

Hurray internet!

------
xigency
What is that even supposed to mean? The abstract doesn't clarify what "NP-
hardness" means in terms of video games.

This looks really click-baity.

In terms of writing a Nintendo game, the solution is a fixed constant: the
game's binary.

In terms of solving a Nintendo game, (playing to completion), the solution is
in constant time: the amount of time it takes to play the game.

Edit: Great, downvotes.

~~~
iamandoni
From the paper:

> For these games, we consider the decision problem of reachability: given a
> stage or dungeon, is it possible to reach the goal point t from the start
> point s? Our results apply to generalizations of the games where we only
> generalize the map size and leave all other mechanics of the games as they
> are in their original settings. Most of our NP-hardness proofs are by
> reduction from 3-SAT.

~~~
xigency
Thanks.

