For Ninja, I could get
77
For example:
. . . . x . x . x .
x x x x x x x x x x
. . . . x . . x . .
x x x x x x x x x x
. . . x . . . x . .
x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x
x x x x x x x x x x
This allows the following arrangements of ships:
A simple arrangement to leave any square of either of the size 4 gaps unoccupied
(the remaining patterns will also leave at least one square of one of the size 4 gaps unoccupied).
4 4 4 4 x 1 x 1 x 1
x x x x x x x x x x
1 . . . x 2 2 x 2 2
x x x x x x x x x x
3 3 3 x 3 3 3 x 2 2
Any two squares of a size 3 gap unoccupied:
4 4 4 4 x 1 x 1 x 1
x x x x x x x x x x
3 3 3 . x 2 2 x 2 2
x x x x x x x x x x
3 3 3 x . . 1 x 2 2
One size-2 gap unoccupied.
4 4 4 4 x 1 x 1 x 1
x x x x x x x x x x
1 . 2 2 x 2 2 x 2 2
x x x x x x x x x x
3 3 3 x 3 3 3 x . .
Any one of the size-1 gaps unoccupied.
4 4 4 4 x . x 1 x 1
x x x x x x x x x x
1 . 1 . x 2 2 x 2 2
x x x x x x x x x x
3 3 3 x 3 3 3 x 2 2
There is also a near-solution for
78, by removing one of the size-1 gaps, but this fails because then both the remaining size-1 gaps must necessarily be occupied;
or by converting one of the size-2 gaps to a size-1 gap, which fails because the middle square of both size 3 gaps must necessarily be occupied.
For Sniper, I could get a few improvements on the previous best answer posted, of which the best is:
46 45 44 43 42
The following pattern of missed shots can work for this total:
. x . . . x . . x .
. . . x . . . x . x
. . x . x . x . x .
x . . . x x . x . x
. . . x . . x . x x
. x . . x x . . x .
x . x x . x . x . .
. x x . x . x . . x
x . . x x . x x . .
. x x . . x . . x .
Placing the size-4 ship:
It fits trivially into the only size-4 gap.
o x o . . x . . x .
o 4 o x . . . x . x
o 4 x . x . x . x .
x 4 o . x x . x . x
o 4 o x . . x . x x
o x o . x x . . x .
x . x x . x . x . .
. x x . x . x . . x
x . . x x . x x . .
. x x . . x . . x .
Placing the size-3 ships:
They fit trivially into the only size-3 gaps.
o x o o o x o o x .
o 4 o x 3 3 3 x . x
o 4 x o x o x o x .
x 4 o . x x . x . x
o 4 o x . . x . x x
o x o . x x . o x o
x . x x . x . x 3 o
. x x . x . x o 3 x
x . . x x . x x 3 o
. x x . . x . o x o
Placing the size-2 ships:
There are 5 size-2 dominoes remaining, but as they are chained together there is only one way to fill 3 (same idea as Jaap Scherphuis answer)
o x o o o x o o x .
o 4 o x 3 3 3 x . x
o 4 x o x o x o x .
x 4 o o x x o x . x
o 4 o x 2 2 x . x x
o x o o x x o o x o
x . x x o x o x 3 o
o x x o x 2 x o 3 x
x 2 2 x x 2 x x 3 o
o x x o o x o o x o
Placing the size-1 ships:
There are 6 gaps remaining, but as 5 of them are chained together there is only one way to fill 4:
o x o o o x o o x 1
o 4 o x 3 3 3 x . x
o 4 x o x o x o x 1
x 4 o o x x o x . x
o 4 o x 2 2 x 1 x x
o x o o x x o o x o
x 1 x x o x o x 3 o
o x x o x 2 x o 3 x
x 2 2 x x 2 x x 3 o
o x x o o x o o x o
A lower bound for sniper
It will not be possible to have a solution for sniper challenge that uses fewer than
41 shots
This is because
-
At least 4 shots are required within the 3x6 region around the size-4 ship to prevent it being in any other place within that region (one at each "end" of the ship, and one to break up each of the 1x6 regions alongside the ship).
-
Similarly, at least 5 shots are required within the 3x5 region around each size-3 ship, and at least 6 shots are required within the 3x4 region around each size-2 ship, to prevent each being in any other place or orientation within that region.
-
After the locations of all other ships are forced, every square not adjacent to a ship must have a missed shot (otherwise a size-1 ship could be moved there). To minimise the number of shots at this stage, the regions blocked off by all ships of size-2 or larger must be non-overlapping.
-
The size-1 ships can only block off a maximum of 3 diagonally adjacent cells in total - otherwise the 4 ships could be moved to the 4 squares that are adjacent to the intended locations of the ships.
-
totalling this, we require a minimum of $4 + 2*5 + 3*6 = 32$ shots within the regions around the size-2 and larger ships, which together block off a maximum of $3*6 + 2*3*5 + 3*3*4 = 84$ squares. A maximum of 7 squares can be left not blocked off (to contain the size 1 ships) so $100 - 84 - 7 = 9$ more shots are required, for a total of $32 + 9 = 41$.
For a provably optimal result we would need
Either to prove that 42 shots are necessary, or that 41 shots are sufficient. The only way to improve on my current best solution would be to have a single chain of 7 diagonally-linked empty squares at the final step, whilst still minimising the number of shots in the regions around the other ships. This also places massive constraints on how the regions can be placed alongside each other so that no extra shots are needed within the regions... I doubt 41 is possible but I've not proved it.