Online Tool Store Online Tool Store
🚢 Games & Fun

· 4 min read

How to Win at Battleship With Parity Search

Manesh Jayawardhana

CIO & Co-founder

Manesh Jayawardhana is the CIO and Co-Founder of Ceyentra Technologies, where he has spent over nine years leading the design and delivery of software solutions for clients across the globe, spanning web, mobile, AI, and capital market systems. He has grown Online Tool Store's engineering team from the ground up while steering the company's technical direction. His writing draws on this breadth of experience building and shipping software across a wide range of industries and markets. View on LinkedIn

Share

How to Win at Battleship With Parity Search

Battleship looks like pure luck and isn’t. There’s a search strategy that halves the number of shots needed to find a fleet, a targeting method that finishes ships efficiently, and a placement approach that makes your own fleet harder to find.

None of it is complicated, and together they’re the difference between a coin flip and a consistent advantage.

Parity: search half the squares, miss nothing

The smallest ship covers two adjacent squares. So any ship, wherever it is, must occupy at least one square of a checkerboard pattern.

Fire only on squares where row plus column is even, and you cover half the board while remaining guaranteed to find every ship. That’s a 50% reduction in search effort for zero risk.

On a 10×10 board, that’s fifty candidate squares instead of a hundred. And once the smallest ships are sunk, you can switch to a coarser pattern — if the shortest remaining ship is three squares, you only need every third square.

Targeting: establish direction before committing

Once you hit, switch from search to hunt.

Fire at the four adjacent squares. On the second hit you know the ship’s orientation, and from there you extend along that line in both directions until it sinks or you hit a miss at both ends.

The common error is guessing the direction after one hit and firing three shots along it. If you guessed wrong, you’ve wasted three shots on water that the adjacent-square method would have identified in one.

Probability targeting: the strong version

A serious engine goes further. For each remaining ship, count every legal placement — every position and orientation that fits on the board without overlapping known misses or sunk ships. Then, for each square, count how many of those placements cover it. Fire at the highest count.

This automatically produces parity-like behaviour during search, and near-optimal targeting after a hit, without any special-case rules. It’s also why a good computer opponent seems to find ships uncannily quickly — it isn’t cheating, it’s counting.

PhaseMethodWhy
SearchParity checkerboardCovers all ships in half the shots
First hitAdjacent squaresEstablishes orientation
Known orientationExtend the lineEfficient completion
AdvancedPlacement countingNear-optimal throughout

Placement: where to put your own fleet

Two rules matter.

Don’t place ships adjacent to each other. A hit reveals a region, and an opponent working outward from it finds the neighbour for free. Spacing your fleet costs them shots.

Don’t cluster in the centre or avoid the edges entirely. Both are patterns human opponents expect. Edges are safer than most players assume, because everyone has heard that edges are obvious and therefore avoids them. Mix it up, and vary between games — a consistent placement style is exploitable.

Common mistakes to avoid

  • Firing at random during the search phase, which roughly doubles the shots needed.
  • Guessing direction after one hit rather than probing adjacent squares.
  • Placing two ships side by side.
  • Continuing to search squares adjacent to a sunk ship’s ends, where nothing can fit.
  • Using the same placement pattern every game against the same opponent.

How to do it with Battleship

The Battleship game includes opponents at several strengths, including a probability-based one.

  1. Place your fleet with spacing between ships and no obvious pattern.
  2. Search using parity, not randomly.
  3. On a hit, probe adjacent squares to establish orientation before extending.
  4. Try the probability-based opponent once you’re winning against the simpler ones.

Other strategy games are in the tools directory.

Frequently asked questions

Where should ships be placed?

Not touching each other, and without an obvious pattern. Edges are safer than most players assume, but never place two ships adjacently — one hit then reveals both.

Does the parity strategy really help?

Substantially. It halves the search space with no risk of missing a two-square ship, and it’s the foundation of every strong Battleship engine.

Is the computer cheating when it finds ships fast?

No. A probability-based opponent counts where remaining ships can legally fit and fires at the most likely square. It’s good, not clairvoyant.

Final thought

Parity during search, adjacent probing after a hit, spacing on your own board. Three habits, and they turn Battleship from luck into a game you can be better at.

Try the free Battleship game

#battleship-strategy#parity-search#grid-game#probability-game#online-tools#free-tools