Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit




Software Project -Assignment1

Programming for Engineers 2021/22 - MSc

[50% of total module marks]


Overview

 

This is an individual assessment worth 50% of your Programming for Engineers module marks.

It involves creating a  game in  C . Note that submissions will be inspected and tested on standard University Lab-PCs. Make sure your code can compile and run on these machines. It is recommended that you use DevC++ for development and include a compiled executable file in your source code submission. Please read these instructions very carefully before you start.

 

Golden Goal - Description

 

The objective of this assignment is to create a simple made-up football game from scratch. There is

no requirement to create a sophisticated GUI – a simple command-line interface will suffice.

For the purposes of this assignment, it will be sufficient to implement the basic game logic, process user inputs, and produce some sensible (text- and symbol-based) output of the current game state. The game is called “Golden Goal” and a partial emulation of a football match with only two players for simplicity. The aim is for the players to be the first to score a goal, which will end the game (hence the name: Golden Goal). Simply put: the player who scores first, wins.

The football field is segmented into 15 zones, each of which has a definitive coordinate indicating its position on the playing field, e.g., {2,1}. See Figure 1 below for details.


 

Figure 1: The playing field of "Golden Goal"


 

Basic rules

 

Player1 always plays from left-to-right, trying to score a goal on the right at {4,1}) and

Player2 always plays from right-to-left with the objective to score a goal on the left at {0,1}.

Location {2,1} is the centre of the field. When the game starts, the player who begins will be at this coordinate together with the ball. The other player will be guarding their own goal at coordinate {0,1} if they are Player1 or coordinate {4,1} if they are Player2. Players take turns in their actions and the game should ask a player what to do (see below).

 

The game proceeds as follows. A player has two possible actions, depending on where the ball is: they can

1) move across the field (including diagonally) by one position per turn (e.g., from {1.1} to

{2.1}). If the player shares a location with the ball, they will take the ball with them to the new location.

2) If a player is at a location together with the ball and it is the player’s turn, they can choose not to move any further but kick the ball to a random new location FORWARD of their current position (towards the opponent’s goal).

So, for instance, when the game starts and the ball is at location {2.1} together with Player1, possible locations for the ball after a kick has been carried out are:

{3,0},{3,1},{3,2},{4,0},{4,1},{4,2}. See Figure 2 below.


 

Figure 2: The match begins - Player 1 starts in the middle in possessions of the ball.


 

Further rules

· When the ball is kicked by a player and lands in the other player’s goal location, the kicking player wins and the game ends.

· However, when the other player is currently residing at their goal coordinate and the ball lands in this location, no goal will be scored (I.e., the goal is defended by that player).

· At the start of the game, one player will be at location {2,1} for kick-off, and the other player will be defending their own goal (Example: Figure 2).

· When it is their turn, a player must always choose an action, they can’t stay where they currently are. If they are not in possession of the ball, they must move. This is to prevent players from “camping” at their goal coordinate.

· When the ball is not kicked or taken with a moving player, it remains in its current location.

· Tackling: When a player moves to a location where the other player currently resides with the ball, the moving player takes possession of the ball and gets an extra action. This means the player can then move further or do a kick. While moving with the ball towards the opponent’s goal has the advantage that the number of target locations will decrease in the next turn, “tackling” will make sure a player can be prevented from moving directly in front of their opponent’s goal without intervention. This will make the game more interesting.

· When a kick has been carried out, the target location where the ball lands must be

randomized (i.e., ball lands at a random location from the set of possible new ball locations).


 

Figure 3: Example - Player2's turn in possession of the ball at {4,0}. Player2 can now either kick the ball to one of the locations indicated in orange, or move with the ball to {3,0},{3,1},or {4,1}.


 

Task

Design, create, and document a program that implements a “Golden Goal” game in  C, using the specification given above. Try to implement as many of the described features as you can.

Anything that has not been clearly defined in the description above can be designed and implemented as you see fit.

Make sure to create a requirements specification for your software project when you start, detailing which core elements of functionality are required to implement the game. Apart from the software code, you also need to document your program both in the code and in the report, as detailed in the next sections (Marking criteria).

 

Additional optional tasks:

Consider adding one or more of the following extensions:

· Create a game interface that shows and updates the state of the playing field after each turn, indicating ball and player locations as the game proceeds. For command-line-based outputs, it is a good idea to simply print out anew the entire playing field after each turn is complete. Adding code for a simple interface like this early on may be a great help for debugging possible errors in your game logic, as you will instantly see the results of different actions!

· Create player via player  or player via computer.

· Add timing  mechanism.  You can develop a goal-scoring mechanism by yourself, and then calculate the final scores according to the goal-scoring rules when the set time expires to determine which player wins .

· Add a skill attribute to the two players that is modified with each kick they perform. One way of doing this might be that an increase in skill also increases the likelihood of a kicked ball landing near or at the goal coordinate.

 

Marking criteria: Program

This assignment requires you to deliver a complete product and demonstrate a range of skills, relating to the design, planning, and implementation of a software program.

You should assume that you are marked on the following aspects of your work, in order of importance:

1. Delivered a (working) “Golden Goal” game

2. The number and quality of game features included

3. Interactivity and usability

4. Runtime performance

5. Quality of the code

6. Quality of the report

 

Please try to adhere to common software development conventions, such as making your code easy to read, choosing sensible identifiers for variables, indenting your code properly, and avoiding code duplication, where appropriate.

In the event that you fail to get your program to run (e.g., when it does not compile), you can still get marks for anything that may be considered part of a sensible approach or solution.


 

 

Marking criteria: Report

Your report is a very important element of the assessment to confirm that you have designed and written the program by yourself and understood the functionality implemented in it. There is a word limit of 2500 words (excluding Appendix). There is no need to submit any code belonging to standard libraries. If any non-standard external libraries were used, please provide a link to where I can find them. However, I want to stress that non-standard libraries are absolutely not needed for this task.

 

Your report should contain the following parts:

 

1. Title page – Your candidate number and report title.

2. Introduction – A brief summary of the game features and basic rules of play.

3. Requirements specification – a description of the objectives, and detailed requirements of your program (e.g., required features, principal mechanisms)

4. Program description – An explanation of how your program works. It may be useful to segment this chapter into sections that describe inputs, outputs, and game state separately.

5. Appendix (source code as text, for referencing from chapter 4)

 

 

Submission Requirements

 

Your submission must come as a single ZIP file containing

 

Your program files, including

§ Source code files

§ Executable file (to run on a standard Windows Lab PC)

 

Your report as PDF

 

You should submit your software online, using the University’s Canvas website. Keep in mind that this is an individual assessment - the related University rules on plagiarism apply. While it is OK to inspect existing programs for learning purposes, it is not acceptable to reuse program code that was developed by your fellow students or copy code from the Web, even if you reference and amend it before submission.

 

 

Submission Deadline

 

Please check your Sussex Direct pages to find out the exact deadline for this assignment.

 

Good luck!