Design code and debug a modified battleships

Assignment Help C/C++ Programming
Reference no: EM132498593

COMP1000 UNIX and C Programming Assignment - Curtin University, Australia

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.

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 andtypes. Collectively, these commentsshould explain yourdesign. (Theyareworth substantial marks - see Section8)

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

Task Details -

1. Input Files

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

Error checking is required on both files and in the case that either of the files is deemed to be invalid the program is to safely exit. Your program should notcontinue in the case of an error being detected but should print out a meaningful error to the user onstderr.

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 cant do any checks outside of FileIO 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.

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 cant explain in 1 simple paragraph then its doing to 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.

Attachment:- C Programming Assignment File.rar

Reference no: EM132498593

Questions Cloud

What are the legal requirements in in relation to changes : What are the legal requirements in in relation to changes in inventory cost flow assumptions for reporting entities in Australia? In your answer
Determine the stability of the limit cycle : Find and classify all the fixed points and Show that the system has a circular limit cycle, and find its amplitude and period.
Discuss about a topic in which you argue for the existence : Write a 750-1000 word essay about a topic in which you argue for the existence of a particular phenomenon by stating a generalization about the topic.
What the budgeted sales peso for eddie incs initial year : Available workforce and equipment. The product will be sold for P20 per unit. What The budgeted sales peso for Eddie Inc's initial year of operations is
Design code and debug a modified battleships : Your task for this assignment is to design, code (in C89), test and debug a modified battleships game. Extract the game settings and values needed from a file
What were some of the more interesting assignments to you : "Interesting Assignments" - What were some of the more interesting assignments to you? "Interesting Readings" - What reading or readings did you find the most.
What budgeted sales in units for next month is : The expected beginning inventory is 12,000 units and the desired ending inventory at the next month is 15,000 units. Budgeted sales in units for next month is
What kollar net cash used in investing activities was : What Kollar net cash used in investing activities for 2019 was? Kollar Corp.'s transactions for the year ended December 31, 2019
Discuss the nature of combat as described in the book : Discuss the nature of combat as described in the book. What motivated the soldiers on both sides of the Battle of Gettysburg to risk their lives

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd