there is a 10 by 10 grid on which the first


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.

Solution Preview :

Prepared by a verified Expert
Application Programming: there is a 10 by 10 grid on which the first
Reference No:- TGS0443568

Now Priced at $15 (50% Discount)

Recommended (96%)

Rated (4.8/5)