Battleship/Battlefield game.

computer science

Description

Overview

The main goal is to implement Battleship/Battlefield game. You can find more information

about the game rules here. The exact description of the game WE implement is provided below.

The implementation is divided into three stages:

1. Programing the initialization of the Ship Maps – HW 1

2. Programming the Battle – HW 2

3. Improving visualization and more – HW 3

Game Objective:

In our game a Human player/User will play with a Computer player. We will implement the

Russian style game (please read the Wikipedia link).

The object of our Battleship is to sink the entire fleet of the computer before it sinks all of your

ships. Each player tries to hit ships of the opponent by guessing/calling out the coordinates of

one of the squares/cells on the board/map. None of the players can see the opponent’s map.

Each board in the physical game has two grids: the lower (horizontal) section for the player's

ships and the upper part (vertical during play) for recording the player's guesses. We will have

two maps (ship map and hit map) for each player in our implementation.

Starting a New Game:

Each player places the 10 ships (1 of a length 4 cells, 2 of a length 3, 3 of a length 4 and 4 of a

length 1) somewhere on the ship map. The ships can only be placed vertically or horizontally.

Diagonal placement is not allowed. No part of a ship may hang off the edge of the board. Ships

may not overlap each other. No ships may be placed on another ship. In the version that we

implement, ships cannot occupy squares next to each other - meaning that ships cannot touch

each other; there must be at least 1 square/cell that separates between two ships.

Once the guessing begins, the players may not move the ships.

Playing the Game:

Player  take turns guessing by calling out the coordinates. The opponent responds with either:

1. "miss" – the guessed cell does not contain a ship

2. "hit" – the cell is a part of the ship, but there are other cells that have not been hit yet

3. “dead” – the cell is a part of the ship and all the other cells of the ship were hit

As soon as all of one player's ships have been sunk, the game ends.


Related Questions in computer science category