Algorithm: Tic-Tac-Toe to Battleship

Battleship

The next assignment is to write a python program YI_battleship1.py using the concepts and algorithms learned in Tic-Tac-Toe. In this version of the program you will only limit the board to be 3 x 3 and only 2 ships: one ship has 3 contiguous places and the other ship has 2 contiguous places. The ships could be placed horizontally or vertically. The purpose of this 1st version of the game is for the computer to guess the player’s ships positions. Your program’s algorithm will allow the player to enter the locations for the 2 ships( 2 and 3 places in length).

Classwork:
With a partner, play on paper our version of battleship but for two players.
1. Make sure you follow the rules of the game.
2. Play the game several times with the ships in different locations.
3. Pay attention to the strategy you use to find the ships and to sink them.
4. Categorize the strategies by the specific locations of the ships. (edmodo.com)
5. Write a short paragraph describing the strategy you use. Make sure your description is categorized by the different locations of the ships.(edmodo.com)

NOTE: You can use random to find a ship but once you have a hit, you should not select the next location using random. Develop an intelligent algorithm.

Homework:
Submit your answers to the following posts (edmodo.com)
1. What python feature would you use to hold the information about the ships locations? (e.g. lists, a list of lists, a dictionary, variables or something else)
2. Describe how you would access that information based on your choice in the previous question.
3. Given that a 3-place ship is located at the upper left corner of the board, write the pseudocode to sink it.