In this assignment, you will implement the well-known board game Battleship in C++. The version that you will develop will be a modified version of the standard Milton Bradley game -- modified both to suit our purposes, and to be simpler in some cases. If you are unfamiliar with the way the game is played in general, please click on the above link to read more. The following description will only identify modifications of the standard game (of course, you may ask your TA any questions about how the game works as you need.)
To begin, download the source code template from the front page of the class website. You may either write this entire program from scratch, or you may use the template to assist you. The template is a fully working program of a simpler version of the game than you are submitting. If you choose to use the template, you will need to modify it heavily (however you see fit) to meet all of the objectives described below.
The version of Battleship that you are designing will have the following features:
When a game is in progress, the program will take inputs from the user as coordinates between 0 and 7 for the x-axis and 0 and 7 for the y-axis. The program will then check the current game board and return one of four possible responses:
In order to effectively design this assignment you need to build on knowledge attained since the beginning of the semester. You may use any design you like (you will be graded on your choices), but in particular, your program should make excellent use of modular, function-based design. Here are some additional, suggested hints to get you started:
Start your program with comments based on your design and (the following cannot be emphasized enough..) add portions of code a little at a time. Compile and run your program on a regular basis, so you always have something that runs, even if it only does part of the job. Make sure you have completed the first task, e.g., printing your name to the screen, before you start writing code for the second task.
Test your program to check that it operates correctly for all of the requirements listed above. Also check for the error handling capabilities of the code. For debugging purposes, it is useful to "echo" any variables you input, and to print intermediate results as they are calculated.
You should comment out your debugging code before you hand in your final version of the program.
When you have completed your C++ program, write a short report (less than half of a page long; a few sentences will suffice) describing what the objectives were, what you did, and the status of the program. Does it work properly for all test cases? Are there any known problems?
Include this report in the comments at the top of your source code file.
Finally, when you are finished, run your full program from start to finish. Copy/paste the entire screen output from at least one full run of your program at the bottom of your source code. Use comments around this output (that is, /* and */) to ensure your program still compiles as-submitted after this addition.
Note: Since an entire game of Battleship can be quite long, you may just take a screenshot of the game in action (include as much as you can in the picture), and submit it as an attachment rather than copy/pasting screen output as described above, if you choose.
To Submit Extra Credit Homework:
(Note: Do not add anything extra to the body of the email! And make sure your FULL name and uark ID number are printed out at the beginning of your program...)
The date/time-stamp on your email will be used to verify that you met the due date above. Since this is an extra credit opportunity, all late projects will ZERO credit. You MUST submit your assignment on time to receive any points, so hand in your best effort on the due date.