Recall the game of Battleship: There is a 10 by 10 grid on which the first player hides three battleships. Each battleship takes up five consecutive grid squares in a line (horizontal or vertical), so 15 grid square are occupied. The second player guesses a series of grid positions and is informed whether each one hits or misses a battleship; once the second player has found all the occupied grid squares, the game is over. You are to write a program that plays the game Battleship. To simulate the first player, randomly choose locations for the battleships. To simulate the second player, devise a strategy for finding all the battleship locations as quickly as you can. Use a divide-and-conquer or binary search approach. (Source: Skiena, Algorithm Design Manual.)
Feel free to make a nice user interface.