Battleship!

This week’s task was a bit more complicated than previous works. This one involved the making of a small battleship game.

The following screenshots take place during lesson number 10.

Lesson 10: You Win!  This lesson asked to make a if statement that checks when you have sunk a battleship.battleship

Lesson 11: Danger, Will Robinson! The task of this lesson is to make an else statement that checks if the user missed a battleship.

b2

Lesson 12: Bad Aim.  Same as the previous two lessons, A new statement was created as an elif statement to check if the user went out-of-bounds with their input.

b3

Lesson 13: Not Again! Another elif statement was created to check if the user made repeat inputs.

b4

Lesson 14: Test Run. A simple test to see if everything is working properly.

b5

Lesson 15: Play it, Sam.  A for loop was added to allow for multiple turns in the game.

b6

Lesson 16: Game Over. A If statement was added in the code to check the number of turns the user is in. If the turn reaches a certain amount, (in this case three) the game will end and show the phrase “Game Over”.

b7

Lesson 17: A Real Win. The command “break” was added in the first if statement to stop the game with a victory if the user correctly finds a battleship.

b8

Lesson 18: To Your Battle Stations! This lesson was used to simply play around with the code that was created.

b9