0

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 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
Dr. belisarius
  • 60,527
  • 15
  • 115
  • 190
Jeff
  • 79
  • 6
  • Possible duplicate of [Code Golf: Lasers](http://stackoverflow.com/questions/1480023/code-golf-lasers). Or not. This question should be migrated to [Puzzles & Code Golf](http://codegolf.stackexchange.com/) anyway. – C. K. Young Jun 15 '11 at 00:49
  • 1
    If this is intended as some kind of challenge it is probably a good fit for CodeGold.SE **after** it has been more completely specified. You can get help on either the [meta sandbox](http://meta.codegolf.stackexchange.com/questions/336/) or the [puzzle lab chat](http://chat.stackexchange.com/rooms/307/golf-puzzle-lab). Alas! Both require a few rep, so you might have to settle for reading [some of our better received puzzles](http://codegolf.stackexchange.com/search?tab=votes&q=closed%3a0). Pay attention to the types of specifications provided and the tagging. – dmckee --- ex-moderator kitten Jun 15 '11 at 02:29

1 Answers1

0

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

Thomas Ahle
  • 30,774
  • 21
  • 92
  • 114