/BattleShip

Module 1 Project for Microsoft: DEV277x Object Oriented Programming in Java in EDX. MARCH 2018

Primary LanguageJava

BattleShip

Module 1 Project for Microsoft: DEV277x Object Oriented Programming in Java in EDX. MARCH 2018

This project will help you get more familiar with arrays. You will be recreating the game of battleships. A player will place 5 of their ships on a 10 by 10 grid. The computer player will deploy five ships on the same grid. Once the game starts the player and computer take turns, trying to sink each other's ships by guessing the coordinates to "attack". The game ends when either the player or computer has no ships left.

Step 1 – Create the ocean map The ocean map is represented by a 10 by 10 grid of different characters. The grid is managed by a two-dimensional array. You will use this 2D array to save where the user and computer decide to place their ships, as well as when someone tries to attack a location and misses. At the start of the game the array will be empty and as the game is played you will change what is stored at each index of the array accordingly. Once you create your 2D array you need a way to display it to the user so they can choose coordinates.