Algorithm: Battleship Day 4

Continuing to prepare for the Battleship program

Classwork:

1. Write the pseudocode to handle checking if there is a ship on one of the edges. What steps would your program follow?

Suggested Classwork:

2. Write a program, Edges4_YI.py to handle the following scenario:

– a hit is found on one of the edges locations on the 3 x 3 board and based on the user’s response write the code to find the ship and sink it.

The idea at every scenario is to find a pattern so you can minimize the code and reuse it.

– Use a list of three lists with 3 items each.
– Randomly select the edges where the program will place the ship.

Screen Shot 2015-02-02 at 7.32.57 AMScreen Shot 2015-02-02 at 8.06.20 AM

Reminder:

Requirements for an A:
1. Don’t forget the introduction with the rules of the game. Let the player know that the ships can only be placed horizontally or vertically.
2. The program has to be turned in on time.
3. The program must have the pygame component.
4. The program has to display at least one board.
5. The program has to handle two ships: 1 of two places and 1 of three places.
6. The program uses a smart algorithm after it finds the first occupied place.
7. The program’s quality of design
8. The program has to run until the game is over.

What will cause a drop in the grade?
The program is not able to tell if the ships overlap.
The program is not able to recognize invalid input.(Prompt the user for valid input)
The program is not able to detect duplicate entries. (Prompt the user for valid input)
The program has no header, no documentation and no output.
The program is over due.