Preparing for Battleship

Preparing for the Battleship program

Play Battleship in a 3 by 3 board and only two ships: two and three squares long with a partner:
Here is an example:
Screen Shot 2015-01-13 at 8.34.50 AM

  • Can you group the locations of the ships in categories?
    The ships could be:

    • Vertical or Horizontal
    • In a corner
    • By the edges
    • In the middle

If you found a ship at a location, what would be your next move based on the grouping mentioned above?

With a partner play multiple times in a 3 x 3 board. Then play with this hit:

Screen Shot 2015-01-13 at 8.40.12 AM

Suggested labeling convention: rows by columns

Screen Shot 2015-02-02 at 9.29.56 AM

A code snippet to help you print each location:

>>> listoflists=[['A','B','C'],['D','E','F'],['G','H','I']]
>>> for i in range(len(listoflists)):
    for j in range(len(listoflists[0])):
        print(listoflists[i][j],end=' ')
    print()

    
A B C 
D E F 
G H I 
>>> 

In pseudocode, write the next possible places that you might choose for the Hit above.

Homework:
Write the pseudocode to choose the next move when finding a hit in each of the four corners.
Screen Shot 2015-01-13 at 9.12.33 AM