Design-code-test and debug a modified battleships game


Assignment Problem:

1. Introduction: Your task for this assignment is to design, code (in C89), test and debug a modified battleships game.

In short, your assignment will:

Extract the game settings and values needed from a file

Interface with the user via a Terminal based menu

Play an adapted game of battleships (single player)

Be able to do conditional compilation

Generate new input files.

2. Code Design:

You must thoroughly document your code using C comments (/* ... */). For each function you define and each datatype you declare (e.g. using struct or typedef), place a comment immediately above it explaining its purpose, how it works, and how it relates to other functions and types. Collectively, these comments should explain your design.

Your code should also be separated logically into multiple c and h files that overall have a single purpose. Marks will be deducted if monolithic functions and/or files are used.

3. Task Details:

1. Input Files - Your program should accept two (2) command-line parameters that will be the filenames of the input files.

2. Menu - After the 2 input files have been read and appropriately stored in memory it is time to have a menu for the user. This menu is to have the following options initially and is to be controlled via integer input:

1 Play the Game

2 List all missiles

0 Exit

3. Playing the Game - Now that the files have been read its time to play the game. The game will consist of a number of rounds and will finish when there are either no missiles left or all ships have been destroyed. For each turn you must display the following:

The board showing all shots (hits and misses) made. (Similar to above)

The amount of missiles left (Not including the current one)

The name of the currently loaded missile (for example "v-line")

A prompt for the user to input the next coordinate to target

This part has many components and as such as been broken down to make it simplier.

4. Add Some Colour - To make the board look nicer were going to print the tiles in different colours depending on what their status is.

5. Remove Some Colour (Conditional Compilation 1) - Now that we have colour lets create a way to disable it.

Your goal is to add a condition compilation called "MONO" that when compiled with your program no longer prints any colours.

6. Find Your Ships (Conditional Compilation 2) - Lets add another conditional compilation to help us find our ships.

Add another conditional compilation called "DEBUG". With this one defined your board is to now print the '#' in a magenta colour if a ship is there and hasnt been shot yet.

7. Need Help - So by now you should be able to shoot missiles at the board and the tiles will change character and colour depending on what was there. However what if a player didnt know how to play the game.

The challenge with this part is to allow the user to type in "help" when they are prompted to enter a coordinate to shoot at. When entered you are to print a description of what that missile does. Remember though that you can't do any checks outside of File IO on which missile it is.

8. Creating Files - Add another 2 options to your Menu

3 Create Board File

4 Create Missile File

The goal of these options is to allow the user to create new input files for the program. As such they must save to the same format as above. These functions should ask the user for all the required information and save them in a file that is named by the user.

How you decide to setup these function and get user input is completely up to you. And to test that your function works, just use the newly created file as the next input file.

4. Report:

You must prepare a report that outlines your design and testing. Specifically:

1. For each file that you have, write a paragraph explaining the overall purpose of it. (Hint: If you can't explain in 1 simple paragraph then it's doing too much)

2. Describe (in 1-2 paragraphs) how you implement the storing and using of the ships on the board and the board. Talk about any complications that you can into while designing this component.

3. Demonstrate that your program works and how to use it (only need to show valid input files), including:

The contents of the input files

The command-line used to execute your program

The output of the board as shown on the screen

The input the user uses to interact with the menu.

The input the user used to play the game.

Your report should be professionally presented, with appropriate headings, page numbers and a contents page. You will lose marks for poorly written/badly formatted reports!

UNIX & C Programming Assignment Help have a huge pool of professional and skilled tutors, who all are capable to cover almost all the topics of any educational level of any complexity level.

Tags: UNIX & C Programming Assignment Help, UNIX & C Programming Homework Help, UNIX & C Programming Coursework, UNIX & C Programming Solved Assignments, Linked List Assignment Help, Linked List Homework Help

Attachment:- UNIX and C Programming.rar

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Design-code-test and debug a modified battleships game
Reference No:- TGS03053060

Expected delivery within 24 Hours