开发者

Laser Grid Puzzle

Saw the following puzzle on HN and thought I would repost here. It can be solved using Simplex, but I was wondering if there is a more elegant solution, or 开发者_JS百科if someone can prove NP-completeness.

Each dot below represents the position of a laser. Indicate the direction that the laser should fire by replacing the dot with ^, v, <, or >. Each grid position i,j should be hit by exactly grid[i][j] lasers. In the example below, grid position 0,0 should be hit by exactly grid[0][0] = 2 lasers.

A laser goes through everything in its path including other guns (without destroying those guns).

2   2   3   .   1   .   2   2   3
1   .   2   1   1   .   1   .   2
2   3   .   1   .   2   .   4   .
.   3   .   2   2   .   2   3   4
1   .   2   .   2   3   2   .   .
2   3   .   3   .   3   2   2   .
3   .   2   4   2   .   2   .   2
1   1   .   .   1   3   .   2   .
.   2   1   .   2   .   1   .   3


If it can be solved with Simplex (Linear Programming) it isn't NP-complete.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜