

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Waclawski; Class: Object Oriented Programming in C++; Subject: Computer & Info Science; University: Syracuse University; Term: Unknown 1989;
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


The aim of this project is to develop an interactive program, simulating a game of battleships between the user and the computer. Gives students a chance to work with C++ concepts like double scripted arrays, random number generation, and basic language constructs. Overview
1. The principle layout will be as follows. When the program is run, a grid is displayed, similar to that shown in the example below: 2. Declare two 8X8 grids. Each is implemented via an 8x8 array in the program. For EXTRA CREDIT, make the grid size adaptable when the program is run. Note that if the grids are too large, they will not fit on the screen nicely, so you may want an upper bound on the grid size. 3. The computer (your program) chooses its random positions of ships, up to five. For EXTRA CREDIT, make the number of ships adaptable when the program is run. Note, the computer’s ship positions are obviously NOT shown to the user as an S on the Computer’s grid. 4. Now the user enters their positions of the ships. 5. After the computer and user enter ship positions, an empty grid with dots is displayed for the Computer’s Navy, and the User’s Navy grid shows the ship’s positions with an S, and dots everywhere else. 6. The user now drops a bomb somewhere on the computer’s grid. This is done by selecting one of the Computer’s grid locations. E.g. 4B or 4b. Based on a hit or a miss, an appropriate message is displayed, and the grids are subsequently refreshed. 7. Now the computer chooses a user’s grid cell at random, and bombs it. The grids are refreshed again, based upon whether or not the computer hit one of the user’s ships. 8. Note that a ship occupies only one grid location, and not several as in the real game. 9. The game continues until the Navy on one side is completely destroyed. 10. You must properly input Doxygen tags to comment your code, per the Doxygen standard provided on the webpage. User’s Navy User’s Hits 1.. S.... S 1. H...... 2........ 2... M.... 3... S.... 3........ 4........ 4........ 5.. *..... 5........ 6........ 6........ 7.... S... 7. M.... H. 8........ 8........ A B C D E F G H A B C D E F G H **H : Hit M : Miss S : Ship