HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Why is determining if there is a solution to a Battleship puzzle NP-Complete?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
whydeterminingcompletebattleshipsolutionpuzzlethere

Problem

This paper http://www.mountainvistasoft.com/docs/BattleshipsAsDecidabilityProblem.pdf says that the decision problem, "Given a particular puzzle, is there a solution?" is NP-Complete. I don't understand why this can't be done in polynomial time. Given constraints that no two ships can be orthogonally or diagonally adjacent, why not just create a grid where there are 2 times as many columns as "bins" with enough rows to put a "separator" run in between every ship. I've seen the reduction demonstrated this way and it seems like it could be done in polynomial time.

Solution

As Andreas T mentions, what you're missing is that the grid is part of the instance.

The instance specifies both the grid and the ships.

Why can't the Battleship puzzle be solved in polynomial time? This is the one million dollar question (literally). But since the paper you mention proves that Battleship is NP-complete, the widely believed conjecture P≠NP implies that Battleship cannot be solved in polynomial time.

The paper goes on to prove that Battleship cannot be solved in polynomial time even when the solution is unique, unless NP=RP, which is also considered unlikely. This is a more realistic version of the problem, since in practice Battleship problems have a unique solution.

Context

StackExchange Computer Science Q#56964, answer score: 5

Revisions (0)

No revisions yet.