Battleship

Overall the exercise purpose is to practice the usage of the list, Battleship is a game where coordinates are said in order to take out your opponent which is good scenario for practice in the List usage. This is great for game design because it is the seed to different types of answers for different type of situations. upon making the list you needed to input raw inputs and many definitions within each other. Finally you were required to design the playing board itself.

battleship-3

once board is taking the argument of a list we make the map

battleship-4

printing

battleship-5

this is the format of the board

battleship-6

We join the rows and columns together

battleship-7

so in order to face an AI you need to make sure the numbers he picks for the coordinates are random so we import random. finally we code to make sure the random row gets a random x and the col gets a random y

battleship-8

so once the AI has determined its column we try to find it by being able for the player to think of the numbers. so we include some raw inputs.

battleship-9

To make sure we have a correct message to serve to the player we need to test out its answer. we program it so we know what the answers are,

battleship-10

we congratulate the player for being correct

battleship-11

Of course if the player misses we must tell them. We program it to have an else argument

battleship-12

We will get those players who go over the grid so we inform them of their actions

battleship-13

if repeats are said we must also tell the player (using past format)

battleship-14

we test the game

battleship-15

More turns need to be added to determine a winner.

battleship-16

once the turns are over a game over must come up to end the game

battleship-17

To end the game we must break the loop using “Break”

battleship-18

The final fully functional game