I've seen the questions on this site with modified Battleship, but I haven't seen one for the standard variation.
So - what is the optimal strategy to win this game?
I've seen the questions on this site with modified Battleship, but I haven't seen one for the standard variation.
So - what is the optimal strategy to win this game?
I'll start with a few points. Some of these are taken from this excellent blog, which I certainly recommend reading even if you don't want to write a computer program.
The main method to lower your attack count is by eliminating half the squares: imagine laying a chessboard over the board. Each ship must have at least two squares, so you are guaranteed to find them all by only checking the white squares. Similarly, once the two-long Destroyers are all killed, you can get away with checking every third square - just the red squares on the below image will catch them all, and so on.
Other than that, aim near the middle of the board. The squares toward the centre are the most likely to contain ships, as the larger 5-long Aircraft Carriers have less possibilities to be put in a corner. Your guesses when trying to locate ships should also be close together (but not adjacent, see the first point).
Once you find a ship, stop your current strategy to sink that ship. This is mostly common sense, but there is an additional tactic to use when trying to sink a ship you have partially found. Your supplied rules say that when hit, you also find out what ship type it is. Unlike the full board, this smaller set of possibilities may be possible to imagine in your head or on a piece of paper. Even with the 5-long Aircraft Carrier, there are at most 18 possible orientations. Eliminate the impossible ones, and guess a square that commonly appears.
Finally, when placing your ships, try to psyche out your opponent. Use corners and edges to counteract the second strategy. Having them run end-to-end is generally good, perhaps less so in this mode, as you will have to call out which ship it is. Instead, cluster them close together - having them diagonally adjacent as in this picture is often tricky to guess, as opponents will prefer to search in the wide open spaces where there are more ways to have a ship.