UMBC CS 201, Spring 01
UMBC CMSC 201 Spring '01 CSEE | 201 | 201 S'01 | lectures | news | help

CMSC 201
Programming Project Two

Naval Battle

Out: Monday 2/26/01
Due: Before Midnight, Sunday 3/11/01

The design document for this project, design2.txt ,
is due: Before Midnight, Sunday 3/4/01

The Objective

The objective of this assignment is to give you practice with project and function design. It will also give you an opportunity to work with a two-dimensional array and passing that array to functions for manipulation.

The Background

This project is loosely based on the game Battleship. Those of you who are already familiar with this game should note that the project description does not follow the same rules as the game. Numerous changes have been made to make a similar game that is much easier to code than the original would be.

The board for this game forms a grid that is 10 rows high by 10 columns wide, that simulates an area of the ocean. Within this area of the ocean are 5 ships, placed there by the computer, but the player cannot see where they are. The objective of this game is for the player to sink all 5 of the ships within a specific number of turns, in our case 40 turns.

For each turn, the player will fire a torpedo into a specific location, indicated by the coordinates of the grid. The computer will then inform the player whether the torpedo hit a target or missed, by placing an O on the board if the shot was a miss or by placing an X on the board if the shot was a hit. A single hit is never enough to sink a ship. The larger the ship, the more hits it can withstand before it sinks. If a ship is 3 units long then it spans three blocks on the grid and would require 3 torpedo hits, one in each of the grid squares occupied by the ship, in order to sink it.

If you would like to practice playing a similar game so that you understand it, I have found a version called Armada on the web that will allow you to play against the computer. Practice Playing Armada

The Task

Design and code a project that will allow you to play Naval Battle against the computer.

The Specifications