· 4 min read
How to Win at Battleship With Parity Search
Manesh Jayawardhana
CIO & Co-founder
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.
| Phase | Method | Why |
|---|---|---|
| Search | Parity checkerboard | Covers all ships in half the shots |
| First hit | Adjacent squares | Establishes orientation |
| Known orientation | Extend the line | Efficient completion |
| Advanced | Placement counting | Near-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.
- Place your fleet with spacing between ships and no obvious pattern.
- Search using parity, not randomly.
- On a hit, probe adjacent squares to establish orientation before extending.
- 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.