Rules of the Game

Battleship is a two-player game of hidden information played on two separate 10x10 grids. Each player secretly deploys a fleet of five ships on their own grid: the Carrier (5 cells), Battleship (4), Cruiser (3), Submarine (3), and Destroyer (2) - 17 ship cells in total. Ships are placed horizontally or vertically, must fit entirely on the board, and may not overlap. On PlayVersusAI, ships are allowed to touch side by side, which matters more for strategy than you might expect (more on that below).

Once both fleets are set, players alternate calling shots at coordinates on the enemy grid. The defender must honestly announce whether each shot is a hit or a miss, and must declare when a ship has been fully sunk - "You sank my Cruiser!" is part of the rules, not just the catchphrase. This version uses the classic one shot per turn rule: a hit does not grant a bonus shot, so a game cannot snowball from a single lucky strike. The first player to hit all 17 of the opponent's ship cells wins.

How a Game Flows on PlayVersusAI

Every match starts in the placement phase. Click your grid to drop the current ship, press R (or the Rotate button) to flip between horizontal and vertical, and click an already-placed ship to pick it back up. The Random button deals a legal layout instantly if you'd rather get straight to shooting. When all five ships are down, press Ready.

In battle, click any unexplored square in the "Enemy Waters" grid to fire. Hits appear as red crosses, misses as small splashes, and a fully sunk ship is announced in the status line and revealed in dark red on the grid. The fleet chips under each board track which ships have been destroyed on both sides. In multiplayer, both players place fleets simultaneously; the battle begins when both press Ready, the host fires first, and each player's ships stay hidden on their own screen for the whole game.

Placement Theory: Spacing vs Clustering

Where you put your ships decides how much information each enemy hit leaks. The two schools of thought are spacing and clustering. Spaced fleets leave water between every ship, so when the enemy sinks one vessel, the surrounding squares tell them nothing - every new hunt starts from zero. Against methodical opponents (and the harder AI levels), spacing is the sound default.

Clustering packs ships against each other, and because touching is legal here, it has a real niche: when the enemy sinks a ship, they usually assume nearby water is empty and move on, so a Destroyer hiding flush against a sunken Carrier can survive surprisingly long. Clustering is a gamble - if the opponent keeps probing around wrecks, they will roll up your whole fleet in one area. A few practical placement rules hold either way: avoid the exact center squares that probability-minded hunters check first, don't hug the edges with your big ships every game (patterns are exploitable across rematches), and place at least one ship touching an edge or corner where placement-counting math assigns the fewest possibilities.

Hunting: Parity and Probability Targeting

Random shooting wastes turns. The first upgrade is parity hunting: imagine the board as a checkerboard. Since the smallest ship is 2 cells long, every ship must cover at least one square of each color - so while searching, you only ever need to shoot one color. That halves the search space from 100 squares to 50 without missing a single possible ship. Once only the 2-cell Destroyer remains you must keep strict parity; while 3-cell ships remain you can even stretch to every third square along a line.

The second upgrade is probability-density targeting, which is exactly what the AI Training difficulty does. For every unknown square, count how many legal placements of the remaining ships pass through it, and shoot the square with the highest count. Central squares naturally score high early, and squares next to unresolved hits score enormously once a ship is wounded. You can approximate this by eye: ask "how many ways could the remaining ships lie through this square?" and prefer squares with lots of open space in all four directions. Finally, master target mode: after a first hit, probe the four neighbors; after a second hit in line, follow that line to both ends before ever testing sideways - ships are straight, so perpendicular guesses are wasted shots until an end is ruled out.

How the AI Difficulties Differ

Each level uses a genuinely different gunnery algorithm, so the difficulty curve is real:

Difficulty Search method After a hit
Easy Pure random shots Nothing - it keeps shooting randomly, even next to a burning ship.
Medium Random search Hunt/target mode: probes adjacent squares, and follows the line after a second hit.
Hard Checkerboard parity search Same hunt/target mode, but its searching phase never wastes shots on off-parity squares.
AI Training Probability-density map Recomputes placement counts for your surviving ships every turn and always fires at the statistical maximum.

Against Hard and AI Training, placement is your main weapon: edge-hugging and irregular spacing lower the density map's peaks and cost the AI extra turns.

Frequently Asked Questions

Can ships touch each other?
Yes. This version allows ships to be placed side by side or end to end, as long as they don't overlap. Some house rules ban adjacent placement, but here touching is legal - and occasionally a useful bluff.
Do I get another shot when I hit?
No. This is the classic one-shot-per-turn variant: hit or miss, the turn passes to your opponent. The "salvo" and "extra shot on hit" rules are separate variants not used here.
Can Battleship end in a draw?
Not in normal play. Turns alternate until one fleet has all 17 cells hit, and the player who completes that first wins immediately - there is no simultaneous finish.
Does the AI cheat and peek at my board?
No. The AI only knows the results of its own shots - hit, miss, and sunk announcements - exactly like a human opponent. Its strength comes from search discipline (parity) and placement statistics, not hidden information.