An algorithm to help you play the perfect game of Battleship

Illustration for article titled An algorithm to help you play the perfect game of Battleship

Though most of us play Battleship by randomly targeting spots on the board with our little plastic nubs, data geek Nick Berry (president of DataGenetics in Seattle) has done an intensive analysis of the game and come up with what he thinks might be the best possible strategy to win.


He begins by acknowledging most people's favorite way of playing Battleship, which is to lob random shots at an opponent:

Mathematically, the chances of playing a perfect game with random firing are easy to calculate and are: 355,687,428,096,000 / 2,365,369,369,446,553,061,560,941,772,800,000 (This equates to, on average, once in every 6,650,134,872,937,201,800 games!) I ran 100 million simulations of random games, and the smallest number of moves I encountered was 44 shots.

So obviously random shots aren't a great way to play a game.

Berry then walks us through 3 other possible strategies, with the third being his improved algorithm (see chart). The improved algorithm manages to halve (almost) the number of moves you need to make compared to random shooting. Maybe somebody will apply this technique to the Battleship movie, and release a "Berry algorithm cut" which is only half as long.

You absolutely must read Berry's entire explanation over on DataGenetics.



Nobody plays completely randomly.