BCS1101 Principles of Programming Battleship Game

Verified

Added on  2019/10/09

|6
|1229
|341
Project
AI Summary
This document outlines a programming project for the course BCS1101 Principles of Programming, requiring students to develop a Battleship game in C. The project involves creating a two-player game with specific ship configurations and rules, adhering to ANSI C standards. Students must submit pseudocode, flowcharts, source code, a design document, and a user manual. The project aims to assess students' ability to apply fundamental programming concepts, logical thinking, and software design skills. The assignment also emphasizes the importance of proper documentation and adherence to coding standards.
Document Page
BACHELOR OF COMPUTER SCIENCE (HONS)
BCS1101 – PRINCIPLES OF PROGRAMMING
Individual Assignment
Instructions:
Answer ALL questions
The answer for each question should comprise Pseudocode, Flowchart and Source
Code.
Marks will be awarded for good presentation and thoroughness in your approach
NO mark will be awarded for the entire assignment if any part of it is found to be
copied directly from printed materials or from another student.
Submit your assignment in hardcopy (printed) and softcopy (save all your works
in to a CD)
Complete this cover sheet (page 1 and 2) and attach it to your assignment.
Student’s Particulars:
Matric No : Intake / Semester :
Student’s Name :
Lecturer’s Name : Assoc. Prof. Dr. Lee Lam Hong
Due Date : Submission Date :
Total number of pages including this cover page :
Official Use:
Marker’s Comment
Marks Awarded : / 100 Overall Marks (20%) :
Student declaration:
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
BCS1101 – Principles of Programming Individual Assignment
I declare that:
I understand what is meant by plagiarism
The implication of plagiarism has been explained to me by my institution
This assignment is all my own work and I have acknowledged any use of the
published and unpublished works of other people.
Student’s signature:……………………………. Date:………………………
Marks Sheet:
Marks Table
Questions Marks
Allocated
Marks
Awarded
a 10
b 40
c 10
d 10
e 20
f 10
Total 100
Overall Total : /100
2 / 6
Document Page
BCS1101 – Principles of Programming Individual Assignment
Question (100 marks)
Battleship (also Battleships or Sea Battle) is a guessing game for two players. It is known
worldwide as a pencil and paper game which dated back since World War I. The purpose of
the game is to destroy all opposing player's battleships, and ends with a fight to the death.
The figure above illustrates a map of one player's ships and the hits against them, from a
game in progress. The grey boxes are the ships placed by the player, and the cross marks
show the squares that their opponent has fired upon. The player would be tracking the success
of their own shots in a separate grid.
The game is played on four grids, two for each player. The grids are typically square –
usually 10×10 – and the individual squares in the grid are identified by letter and number. On
one grid the player arranges ships and records the shots by the opponent. On the other grid
the player records their own shots.
[Source: https://en.wikipedia.org/wiki/Battleship_(game)]
Write a Battleship computer game in C language to fulfil the criteria described using standard
ANSI C Programming Language.
(a) Your computer game shall follow strictly the configurations below: (10 marks)
The size of the game board should be a 10x10 grid
The game can be played by 2 players.
The types and number of ships for each player are as below:
Class of
ship Size Number
3 / 6
Document Page
BCS1101 – Principles of Programming Individual Assignment
Carrier 5 1
Battleship 4 2
Cruiser 3 3
Submarine 3 4
Destroyer 2 5
(b) Your computer game shall incorporate the following rules: (40 marks)
Before play begins, each player secretly arranges their ships on their primary grid.
Each ship occupies a number of consecutive squares on the grid, arranged either
horizontally or vertically. The number of squares for each ship is determined by
the type of the ship. The ships cannot overlap (i.e., only one ship can occupy any
given square in the grid). The types and numbers of ships allowed are the same for
each player.
After the ships have been positioned, the game proceeds in a series of rounds. In
each round, each player takes a turn to announce a target square in the opponent's
grid which is to be shot at. The opponent announces whether or not the square is
occupied by a ship, and if it is a "miss", the player marks their primary grid with a
white peg; if a "hit" they mark this on their own primary grid with a red peg. The
attacking player notes the hit or miss on their own "tracking" grid with the
appropriate color peg (red for "hit", white for "miss"), in order to build up a
picture of the opponent's fleet. After the player gets a hit the player continues
shooting until the player gets a miss.
When all of the squares of a ship have been hit, the ship is sunk, and the ship's
owner announces this (e.g. "You sank my battleship!"). If all of a player's ships
have been sunk, the game is over and their opponent wins.
[Source: https://en.wikipedia.org/wiki/Battleship_(game)]
4 / 6
tabler-icon-diamond-filled.svg

Paraphrase This Document

Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Document Page
BCS1101 – Principles of Programming Individual Assignment
(c) Your computer game shall be packaged into an .exe program file associated with an
application icon and run in Fullscreen mode. You should not run your program from
Eclipse CDT.
(10 marks)
(d) Your program source code must be submitted online and adhere to the QIUP C
Programming Standard.
(10 marks)
(e) Your assignment shall include the following documentation: (20 marks)
A Design Document containing:
i. Flowcharts describing the algorithms of your program.
ii. Functions description detailing the use of each function in your
program.
A User Manual on how to configure the game settings and/or play the game
e.g. Press <space> to roll the dice.
(f) You shall demonstrate and walkthrough your computer game in fulfilling the game
settings and the rules above.
(10 Marks)
Submission Dateline: 5pm, 13th January 2017
Assignment Objectives
The aim of this assignment is to assess student’s ability to program in C programming
language, be able to adopt and apply the fundamental programming concepts e.g. arithmetic
operations, conditional statements, loops, arrays and functions. It is also essential to train
students’ ability in logical thinking and sharpen their software design skills by expressing
their work using flowcharts and functions description.
General Guidelines
Academic Honours Code applies to this assignment. Plagiarised work would not be marked.
Refer to Academic Honours Code at http://goo.gl/k1HROA
The use of any third-party C libraries other than those available from Standard ANSI C is
strictly prohibited. Standard C library reference can be found at https://reference.cs50.net/
Excessive use of inappropriate comments, line breaks or unused variables in the source code
will be penalised. ‘Spaghetti’ code is not wanted.
5 / 6
Document Page
BCS1101 – Principles of Programming Individual Assignment
A detailed illustration of flowcharts and concise description of functions description are
desirable.
The Design Document must be concise in headings, with consistent alignment, clear
description and illustration used. No extra mark will be given for superb graphic design.
END OF QUESTION PAPER
6 / 6
chevron_up_icon
1 out of 6
circle_padding
hide_on_mobile
zoom_out_icon
[object Object]