Licence MIASHS · Java · pair project

The bot shoots where the ships still fit.

Four targeting strategies, benchmarked over 300 games each. The winner is not the expensive one: a placement-density heatmap beats Monte Carlo simulation while costing a fraction of the computation.

Below is a real recorded game, not a re-enactment. The shots and the grid behind them both come out of the Java run, so what you are watching is the program that produced the numbers further down.

hit miss ship likely unlikely
0

How the heatmap is built

For every ship still afloat, the bot slides that ship across every position on the board and counts the placements that no missed shot rules out. A cell's value is how many surviving placements cover it, so the brightest cell is simply the one the most remaining fleets pass through. Each miss deletes every placement crossing it, which is why whole regions go dark at once.

The parity weighting is the part worth noticing: cells are boosted or halved depending on (row + column) % shortest_remaining_ship. Because no ship can hide between two cells of that lattice, checking it first cannot miss anything, and it is what turns the opening from a scan into a sweep.

Results

Win rate across 300 games per bot, whiskers are one standard error. Source: Results/tournament_summary.csv.
Mean shots to finish, 100 trials, whiskers are one standard error. Markov clears a 10×10 board in about 55 shots against 94 for random fire, and the board holds only 100 cells. Source: Results/performance_summary.csv.
Head to head, wins by the row bot against the column bot out of 100. Source: Results/tournament_pairwise.csv.

How to read these numbers

Same fleet, both bots

The identical ship layout, played by the heatmap bot and by random fire, advancing one shot at a time. This is one game each, not an average.

Markov

Uniform

The code

Javadoc API documentation Every class, generated from the source. Source The strategies Markov, Monte Carlo and Uniform, plus the hunt-and-target state machine. Write-up README Rules, strategies and the full results table.