Understanding Probability in Battleship
Battleship isn't just guessing - it's applied probability theory. Understanding the mathematical foundations transforms you from casual player to strategic expert. Let's explore the numbers behind optimal play.
Basic Probability Foundations
The Starting State
A standard Battleship game begins with a 10x10 grid (100 squares) and five ships occupying exactly 17 squares total:
- Carrier: 5 squares
- Battleship: 4 squares
- Cruiser: 3 squares
- Submarine: 3 squares
- Destroyer: 2 squares
Initial hit probability = 17/100 = 17%
This means firing at a random square at game start has a 17% chance of hitting something. Conversely, you have an 83% chance of missing. This immediately tells us that most shots will miss - expecting otherwise is statistically naive.
Expected Shots with Pure Random Firing
If you fire completely randomly (no strategy), how many shots are needed on average to sink all five ships?
The mathematical expectation is approximately 59 shots. This assumes you eventually hit all 17 ship squares plus the misses required to "find" them through random searching.
However, this is a worst-case scenario. Any systematic strategy beats random firing, which is why understanding probability matters.
Probability Heat Mapping
What is a Heat Map?
A probability heat map assigns each square a score representing the likelihood that it contains part of a ship. This score is calculated by counting how many different valid ship placements include that specific square.
Center Square Advantage
Consider square E5 (dead center). A carrier can be placed in multiple positions that include E5:
- Horizontally: Starting at A5, B5, C5, D5, or E5
- Vertically: Starting at E1, E2, E3, E4, or E5
That's 10 different carrier placements including E5. Repeat this calculation for all five ships, and E5 accumulates a high probability score.
Now consider corner square A1. The carrier can only be placed:
- Horizontally: Starting at A1
- Vertically: Starting at A1
Only 2 placements! This is why center squares have higher probability than corners - they participate in more possible ship configurations.
Dynamic Heat Maps
Heat maps must update after every shot. Each miss eliminates not just that square, but all ship placements that would have included it. Each hit dramatically increases probability for adjacent squares since ships extend in straight lines.
Advanced players maintain mental heat maps throughout the game, constantly recalculating based on new information.
The Parity Principle
Mathematical Basis
Imagine coloring the board like a checkerboard with alternating black and white squares. Any ship of length 2 or greater must occupy at least one black square and at least one white square.
This means if you fire at all 50 black squares, you're guaranteed to hit every ship at least once. This is the mathematical foundation of checkerboard searching.
Parity Optimization
The destroyer (2 squares) is the limiting case. It requires exactly 2 squares, so it could theoretically occupy one black and one white. But the carrier (5 squares) must occupy either 3 black/2 white or 2 black/3 white.
This asymmetry means that after checking one parity completely, the probability distribution for remaining ships shifts toward the opposite parity, but not uniformly. Larger ships have higher probability of occupying more squares of the less-searched parity.
Expected Shots with Checkerboard
Using pure checkerboard strategy (no probability weighting), you'll find all ships within 50 shots guaranteed, then need additional shots to sink them completely. Expected total: approximately 45-52 shots depending on ship placements.
This represents a 12-24% improvement over random firing - significant but not optimal.
Conditional Probability
After First Hit
When you score your first hit on a ship, the probability landscape transforms dramatically. The four adjacent squares now have conditional probabilities much higher than their original heat map values.
Specifically, one of those four squares has a 100% probability of containing the ship (assuming the ship isn't length-1, which none are). The other three have 0% probability for that specific ship.
But you don't know which is which! So you must treat all four as high-priority targets, each with 25% probability of being the correct direction.
After Second Hit
Once you have two hits in a line, you've determined the ship's orientation. Now probability becomes deterministic in two directions (continuation of the line) and zero in the perpendicular directions.
The ship extends either forward or backward (or both) from your hits. Without edge constraints, probability is 50/50 for forward vs. backward. With edge constraints (hits near borders), probability shifts toward the direction with more space.
Multiple Ships in Progress
When you have partial information about multiple ships, probability calculations become complex. You must weight probabilities based on ship sizes that remain unsunk and spatial constraints for each.
This is where human intuition often fails and algorithms excel - tracking multiple probability distributions simultaneously is cognitively demanding.
Expected Value Calculations
Information Gain
Advanced probability analysis considers not just the likelihood of hitting a ship, but the INFORMATION GAINED from each shot regardless of result.
Firing at a high-probability square might hit a ship (good), but firing at a square that eliminates many possible ship placements regardless of outcome also has value.
Expected Value (EV) of a shot = (Probability of Hit × Value of Hit) + (Probability of Miss × Value of Miss)
Where "value" includes both immediate tactical benefit and information gain for future decisions.
Optimal Shot Selection
The mathematically optimal shot maximizes expected value, not necessarily raw hit probability. Sometimes a lower-probability shot that eliminates more possibilities is superior to a higher-probability shot that provides less information.
This is why computers can outplay humans in Battleship - they calculate EV perfectly for every square on every turn. Humans rely on heuristics and approximations.
Ship Size Probability Distribution
Differential Find Rates
Not all ships are equally likely to be found at any given time:
- Carrier (5): Highest find rate - requires long uninterrupted spans
- Battleship (4): Second-highest - moderately constrained
- Cruiser/Submarine (3 each): Medium - fit in many locations
- Destroyer (2): Lowest - fits almost anywhere
Statistically, ships are typically found in order of descending size. The destroyer is almost always the last ship located.
Late-Game Probability Adjustment
Once large ships are sunk, recalculate heat maps considering only remaining ship sizes. A region with only 3 consecutive open squares can't contain the carrier, so eliminate it from carrier probability calculations.
As the game progresses, certain areas become impossible for remaining ships due to surrounding misses creating "too small" pockets. These elimination zones shrink the effective search space, increasing relative probability for viable regions.
Probabilistic vs. Deterministic Phases
Hunt Mode (Probabilistic)
Before finding a ship, you're operating in probabilistic space. Every square has some probability, none are certain. Your goal: maximize expected hits per shot through heat map optimization.
Key insight: Small improvements in probability (choosing a 18% square over a 17% square) compound over many decisions. Optimizing every shot matters.
Target Mode (Deterministic)
After hitting a ship, you enter quasi-deterministic space. You KNOW the ship extends from your hit - the question is merely "which direction?"
With two hits, it becomes fully deterministic - continue in the established direction until the ship is sunk. Probability doesn't apply; logic does.
Mode Switching Optimization
The transition between modes must be instantaneous and absolute. Staying in Hunt Mode after a hit wastes your deterministic information. Returning to Hunt Mode before sinking the ship wastes your partial deterministic information.
Probability calculations are valuable in Hunt Mode but irrelevant in Target Mode. Understanding which mode you're in guides decision-making.
Monte Carlo Analysis
Simulation Approach
Because exact probability calculations become computationally intensive (especially with partial information about multiple ships), advanced AI often uses Monte Carlo methods:
- Generate thousands of possible ship placements consistent with known information
- Count how many placements include each square
- Use these counts as probability estimates
- Fire at the square with highest count
This approximates perfect probability calculation while remaining computationally feasible even on modest hardware.
Convergence to Optimal
With sufficient simulations (typically 1000+ per decision), Monte Carlo estimates converge to true probabilities. This is how the highest-difficulty AI achieves near-optimal play.
Practical Applications
Mental Shortcuts for Humans
You can't calculate exact probabilities for 100 squares in real-time during play. Instead, use these heuristics:
- Early game: Prioritize center over edges (rough 2:1 ratio)
- After misses: Avoid firing adjacent to confirmed empty squares
- With hits: Adjacent squares become absolute priority
- Late game: Consider only regions where remaining ships actually fit
- Always: Maintain checkerboard parity discipline
These rules approximate optimal probability without requiring complex calculations.
When to Deviate from Probability
Sometimes tactical considerations override pure probability:
- Sinking a ship with 1 remaining segment (certain) beats exploring a 25% square
- Testing a critical hypothesis (is there a ship in this corner?) might justify suboptimal probability
- Maintaining checkerboard pattern discipline sometimes means skipping a marginally higher-probability square
Probability guides strategy but doesn't dictate every decision robotically.
The Limits of Probability
Variance and Luck
Even perfect probability-based play doesn't guarantee victory. Random variation means you might fire at a 20% square and miss while your opponent fires at a 15% square and hits.
Over many games, probability-based strategy wins more often. In any single game, luck plays a significant role. Accept this variance and focus on long-term win rate, not individual game outcomes.
The Irreducible Minimum
There's a theoretical minimum shots required to win Battleship - approximately 35-40 shots with perfect strategy and perfect luck. Even optimal probability play can't break this barrier without exceptional fortune.
If you're consistently winning in 42-50 shots, you're playing near-optimally. Expecting better requires luck more than skill.
Key Takeaways
- Initial hit probability: 17% (17 ship squares / 100 total)
- Center squares have higher probability than edges/corners
- Checkerboard searching cuts search space in half mathematically
- After a hit, adjacent squares become 25% each (one is 100%, three are 0%, but you don't know which)
- Expected value combines hit probability with information gain
- Larger ships are found first statistically
- Heat maps must update dynamically after every shot
- Perfect probability play reduces average shots from ~59 (random) to ~42 (optimal)
Ready to apply probability theory to your game? Play Sinkships Now!