In this Lab the purpose of the code being written was to mimic the classic board game Battleship. The code creates a 5 by 5 grid and asks for the users input for a column and a row then checks to see if the randomly generated battleship was hit or not. If the ship was hit there will be a message printed saying “Congratulations! you sunk my battleship” otherwise “You missed my battleship!”. The code also checks to see if the input is in the 5 by 5 grid again if the input doesn’t comply it prints “Oops, that’s not even in the ocean.”
-
Recent Posts
Tags
May 2024 M T W T F S S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31