Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This could use a better title; the noteworthy thing here is not that Pac-Man is NP-Hard, but that this guy has covered the computational complexity of a whole bunch of games at once.


He also changed basic game mechanics to make it NP-Hard. Packman's scoring is based on collecting items and is not time dependent. So there are effectively unlimited games that all share a perfect score unlike the traveling salesman which has a single optimal solution. To make it NP-Hard requires one way paths though the maze.


same with starcraft: "Suppose the two players have bases on diff erent islands, player B has a strong ground army but no income and no way to reach player A, while player A has no units and needs exactly x resources to train an army and barely defeat B. Player A starts with just enough resources to train a worker. In yet another un- reachable island, there are n locations, each of which has a main building of A (to which workers must bring the resources they collect) and x=n resources. There is also a worker in each location, but it is "trapped" behind some resource batches, and cannot reach the main building. On each path connecting two locations, there is a turret (or other static defence) of B, positioned in such a way that a lone worker traversing the path isbound to be killed, but if two workers traverse it, exactly one survives. B hopes for a draw, while A has only one strategy: Train a worker at some location, collect the resources, thus setting the second worker free, traverse a path with both workers to reach another location, and repeat. A cannot waste resources into training more than one worker, and can win if and only if the (planar) graph of locations has a Hamiltonian path."

which raises the question - what is a game? is it the collection of all possible permutations of states allowed by the rules, as in the Pac-Man generalization or this extremely weird corner case SC scenario that requires extended amounts of sub-optimal play? If I -can- construct such a bizarre and entrenched StarCraft position, is it part of "the game", or is it a weird theoretical custom map whose sole purpose is proving starcraft is np-hard to "solve"


It is also possible that on any legally-sized starcraft map the number of nodes in the graph would be so small that the solution would be trivial.

But at the same time it's fascinating that they were able to embed this sub-problem within a starcraft scenario, such that any optimal player would have to solve this NP-hard problem. This sort of argument is a classic in the field, and always fun to read.


Why try so hard? Just make a UMS map that implements Tic-Tac-Toe. StarCraft: solved!


Packman's scoring is based on collecting items and is not time dependent.

The author does not bring completion time into this at all. He reduces (a still NP-complete subset of) Hamiltonicity to the question of whether a Pac-Man level can be completed without dying.


No it doesn't. NP-Hard just states that it's NP-Complete + Polynomial Turing Time reducible to H.

NP-Complete just means that a correct solution can be evaluated in polynomial time by a deterministic Turing machine. It says nothing of the number of solutions that exist.


You've got this a little backwards. Being in NP means a correct solution can be checked by a deterministic TM in polynomial time. A problem is NP-hard if any problem in NP is polynomial time Turing reducible to it. NP-complete problems are those that are NP-hard and in NP (an NP-hard problem need not be NP-complete).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: