SCC110: Software Development Term 3. Programming Project.
Project Title: Programming Project
Moodle Submission Deadline: 16:00 Friday Week 25 (demo in week 25 lab!)
Assessment Mode: Continual Assessment via SCC110 Git Server with in lab demo
Aims
In this final term of your first year, there is a single task - a project that is designed to bring together
many of the programming techniques that you have learned over the course of the year. This project
represents the final piece of practical coursework for SCC110. It’s time to show us what you can do!
You have a choice of projects to undertake, to be selected from the three choices below, and you
need to pick just one of these projects. Read each of them carefully before choosing which project
to undertake. Please note that the projects state which programming language you must use for that
project (either C or Java). This is a good opportunity to push yourself out of your comfort zone and
get support getting ready for the exam, so don’t be afraid to pick your least favourite of the
languages – this is about learning!
Getting Support
We will be running SCC110 lab sessions in weeks 21-25 inclusive. Use these sessions to get Individual
one-on-one support from the staff and teaching assistants. You should attend your timetabled
session for support. If you feel you would benefit from attending other sessions, feel free to do so if
there’s space, but please do be considerate as staff will prioritise students in their own timetabled
slot.
Please note, teaching assistant time is necessarily limited so please avoid messaging them outside
of timetabled lab hours without prior agreement. They are only paid for the hours they deliver
labs and have their own jobs to do too.
SCC110: Software Development Term 3. Programming Project.
Submission and Assessment
This work will be assessed partly through a practical demonstration and code inspection of
your work, then this will input into our marking based on your code quality and the features
highlighted below. You will be asked to present your work in your Week 25 lab session. Be
prepared to take the lead in demonstrating your project, and to answer questions about it
posed by your markers.
- You MUST submit your code to Moodle by the advertised deadline in a .zip file.
- You MUST share your private GitHub repository by the advertised deadline using the
version control submission instructions below.
- You MUST demonstrate your work IN YOUR OWN TIMETABLED LAB SESSION.
- You MUST ensure that your project can be compiled FROM THE COMMAND LINE,
without the need for an IDE.
- The standard University regulation on permitting late submission of coursework
DOES NOT APPLY TO THIS COURSEWORK ASSIGNMENT.
- Naturally this should be your own work as a matter of honour, and we will check for
plagiarism just in case. This tech is evolving all the time and may check for the
involvement of AI including co-pilot and ChatGPT.
FAILURE TO ADHERE TO THE ABOVE WILL RESULT IN A FAIL MARK (F4) BEING RECORDED.
Version Control Submission
The use of git version control for your project is expected as part of the marking scheme. To
submit your private GitHub repository, you must do the following:
1. Invite the scc110-2023 user as a collaborator to your GitHub repository. You can do
this just as we showed you earlier in the course. Remember you can invite a user
through the Settings -> Collaborators page on your GitHub repository.
2. Submit the FULL URL of your project GitHub repository to this form:
https://forms.office.com/e/HUwVb646Q1
This repository will also act as your formal point of submission. Ensure your repository is up to
date by the deadline.
Assessment
This work will be assessed by a code review of your github repository combined with a demo of your
code. Teaching Assistants and staff may also ask you questions using github issues before and after
project submission, so make sure you keep an eye on your repository and answer any questions that
they raise. If you leave it to the last minute, staff won’t have the chance to ask questions during the
SCC110: Software Development Term 3. Programming Project.
term, and you will likely not receive marks associated with these questions. Do not leave this work
to the last minute.
You are also required to complete a short file called README.md in your repository that describes
the capabilities of your program and precisely how to run it. This can be either a simple text file, or
use markdown (a simple language for adding formatting into text files):
https://www.markdownguide.org/getting-started/
FAILURE TO ADHERE TO THE ABOVE MAY RESULT IN A FAIL MARK (F4) BEING RECORDED.
Marking Scheme
Your work will be marked based on the following four categories. Your final grade will be determined
based on a weighted mean of these grades according to the weighting shown in the table below.
Project Functionality
- See individual project descriptions below for indicative levels of the
functionality expected.
50%
Code Structure and Elegance
- Modularity of code
- Use of appropriate data types and libraries
- Use of appropriate language constructs (arrays, loops, functions,
methods, classes)
20%
Code Style
- Appropriate comments, code indentation
- Appropriate name/scope of variables and functions / methods
10%
Communication
- Quality of the README.md guide
- Ability to answer any questions raised by TAs via git issues
10%
Use of GIT version control
- Clean and regular commits
- Appropriate commit messages
10%
In all cases a grade descriptor (A, B, C, D, F) will be used to mark your work in each category. The
following sections provide an indication of the level of functionality expected.
Markers may also recommend the award of a distinction (+) category overall if they feel a piece of
work exhibits clearly outstanding practice.
SCC110: Software Development Term 3. Programming Project.
Project Title: Project 1: Space War!
Language: C
The first video game ever ‘SpaceWar’ was created at MIT On the DEC PDP-1 (see YouTube and
Wikipedia). It’s the first classic ‘shoot’em’up’ arcade game. In space war two player spaceships duel
with each other surrounding a ‘singularity’ (black hole) which pulls the spaceships in (and can also be
used for fancy slingshot maneuvers!). Ships have a limited number of torpedoes (not affected by
gravity), which can be fired at a maximum rate. There is also limited fuel to ‘thrust’ out of trouble!
The original fade in the 1960s phosphor display gave a pleasing ‘trail’ effect! Up to you whether you
attempt to re-create this for ‘aesthetic’ merit.
Like later games such as Asteroids, ships could initially only rotate, thrust and fire. Later versions of
the game included a hyperspace jump (to a random location), which even got more dangerous and
risky with each use.
The original code fitted in 4K of memory… so consider it an extra challenge to craft beautiful minimal
code.
SCC110: Software Development Term 3. Programming Project.
The aim of this project is to recreate your version of this classic on UNIX creatively using ASCII
character graphics (e.g., on an 80x25 character terminal) using the C language. The simplest version
of the game will feature a ship, an approximation of a singularity with gravity, keyboard controls for
thrust and direction and a score. More advanced versions could include hyperspace, different or
multiple black holes, or special features such as enemy spaceships.
The exercise focuses on your ability to:
• Solve the challenge of creating a simple game (game loop, score etc.);
• Exercise your problem-solving skills, especially in the simulation of the spaceship, the black
hole and their physics;
• Work out algorithms to control the ship, rotate, thrust, detect collisions, perform the game
logic;
• Generate a GUI for the user to interact with the ship (using simple ASCII art & the UNIX
ncurses library)
• Demonstrate good code modularity, efficiency and style.
Start-up task:
This task is to be completed in your Week 21 practical in order to give you a better feel for this
project and to give you valuable insight for your design.
1. Research SpaceWar! To get a good understanding of the gameplay. Make notes on the
features of the game you can see – pay particular attention to the phases of gameplay (start,
middle, end). What happens when you run out of time or fuel, thrust over a screen edge,
get sucked into the singularity, hyperspace etc.?
2. Read the introduction to the ncurses library (sections 1-1.3):
http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/intro.html
3. Look back over term 1 and remind yourself of how to use visual code for C, compile C
programs, and so on.
4. Try the ‘hello world’ example: http://tldp.org/HOWTO/NCURSES-ProgrammingHOWTO/helloworld.html - you’ll need to #include in your C file and
compile using ‘-lncurses’ with gcc.
Now try to create a C program that uses the ncurses library to let you control the position of a
symbol (e.g. ‘*’) on the screen using keyboard input. Tips: lookup mvprintw, getch and
timeout in the man pages/online.
SCC110: Software Development Term 3. Programming Project.
Marking Scheme:
Marks will be awarded according to the marking scheme shown at the start of this document. Marks
for the ‘Functionality’ section will be awarded based on individual merit, but the following table
gives an indicative overview of the level of functionality expected for each grade band:
A: Working program that meets the criteria for a B, plus:
- Approximation of gravity due to the singularity, drawing ships in/ slingshot
etc.
- Limited fuel.
- Limited torpedoes & maximum firing rate.
- Advanced features, such as one or two of:
▪ Hyperspace (the ship can jump to a random location not on the
singularity or other player ship);
▪ Progressing 'rounds' with increasing difficulty (e.g., stronger gravity;
more singularities)
▪ Others, options might include e.g., splash screen, high score table,
enemy spaceship (non-player ships), movement trails.
B: Working program that meets the criteria for a C, plus:
- Two player ships that can move/ thrust/ collide with one another.
- Users can 'fire' across the screen in the way the ship is facing.
- Bullets can collide and disappear when hit.
- Score is awarded appropriately and displayed.
C: Working program that meets the criteria for a D, plus:
- A black hole in the centre.
- The ship can move (thrust) as well as rotate.
- Basic collision detection (the ship can be destroyed if hits the black hole).
D: Working program that:
- shows a representation of at least one spaceship.
- The player can rotate the ship using the keyboard.
F: No working program demonstrated, or program does not meet any requirements
listed above.
SCC110: Software Development Term 3. Programming Project.
Project Title: Project 2: Air Hockey
Language: Java
Project Overview:
Simulations are excellent ways to test your ability to implement programs to well-defined
specifications. The aim of this project is to make use of an advanced version of the GameArena
classes you used earlier this year to implement a simple graphical simulation of the game Air Hockey
shown in Fig. 2a:
Figure 2a: An example of the Air Hockey application using GameArena.
The rules of the game are simple. The game requires two opposing players, a low-friction (but not
zero friction) table, two mallets – also known as strikers or paddles – and one puck. Each player
attempts to score a point by hitting the black puck with their mallet into the other player’s goal. A
player may only strike the puck when it is on their side of the centreline. Mallets may not cross the
centreline when striking the puck. If a player accidently puts the puck into their own goal, the other
player wins a point. Each time a player wins a point, all pieces are reset to their original position and
the other player serves the puck from their side of the centreline. The first player to gain 6 points
wins (but players should be allowed to set this value to any number before the game starts).
Project Requirements:
Your task is to implement a working two-player game of Air Hockey based on the advanced
GameArena classes provided for this project. In addition to drawing Balls and Rectangles, the latest
version of the GameArena classes include support for Lines, Text, mouse input, additional key
presses, layering of objects and arbitrary colours. This is available via Ioannis’s GitHub repository1 at
https://github.lancs.ac.uk/chatzige/SCC110-AirHockey. See the JavaDoc documentation contained
inside the GitHub repository for information on how to use these new features.
1 When you attempt to access the GitHub repository, you may be asked for your Lancaster University
credentials. If a “404” error message appears, try clicking on the URL link again.
SCC110: Software Development Term 3. Programming Project.
Your final Air Hockey simulation should:
- Display a simple view of an Air Hockey table, similar to that shown in Fig. 2a.
- Allow the user to play a two-player game of Air Hockey against another human player e.g.,
through keyboard input. There is no need for a computer opponent, although this would be
awesome.
- Allow players to move their mallet in a user-friendly manner within their half of the table.
- Place the puck in the centre of the table at the start of the game (see Fig. 2a) and the
appropriate serving position at the end of each round, ensuring that the player who lost a
point serves the puck from their own half of the table (see Fig. 2b and Fig. 2c).
- Display the movement of the black puck around the table accurately, including simulating
friction and ensuring the puck bounces off the four cushions of the table.
- Implement the basic rules of the two-player Air Hockey, with a player scoring points for: hitting
the black puck into the other player’s goal or the other player scoring an own goal. If the puck
is heading toward a player’s goal at high speed, you will need to project the position of the
puck into that player’s goal to decide whether the puck has gone in or out; in the latter case,
the puck should bounce off.
- Include sound effects (available in Ioannis’s GitHub repository) to make the game more
engaging, display the score at each round, display the end-of-game result announcing the
winning player, and provide an option for users to play again.
Figure 2b: Player 1 (on the left) is about to serve because
Player 2 (on the right) scored.
Figure 2c: Player 2 (on the right) is about to serve
because Player 1 (on the left) scored.
A video of Air Hockey in action can be found here:
https://estream.lancaster.ac.uk/View.aspx?id=64850~5k~cFWvC8GWUl
Handling Deflections:
To complete this project, you will need to determine how the speed and direction of the puck
changes when it is hit by a mallet. Algorithms to do this are known as Physics Engines and are a key
element of many computer games. The following algorithm calculates the velocity of two balls after
collision, given the position and velocity of the two balls before collision. You are free to copy, paste,
edit and use this code as part of your project. Consider which class should contain this algorithm as a
SCC110: Software Development Term 3. Programming Project.
method, and how this algorithm can be adapted for the case of a puck and a mallet (the velocity of
the mallet after collision can be ignored since it is handled by a player).
public void deflect()
{
// The position and speed of each of the two balls in the x and y axis before collision.
// YOU NEED TO FILL THESE VALUES IN AS APPROPRIATE...
double xPosition1, xPosition2, yPosition1, yPosition2;
double xSpeed1, xSpeed2, ySpeed1, ySpeed2;
// Calculate initial momentum of the balls... We assume unit mass here.
double p1InitialMomentum = Math.sqrt(xSpeed1 * xSpeed1 + ySpeed1 * ySpeed1);
double p2InitialMomentum = Math.sqrt(xSpeed2 * xSpeed2 + ySpeed2 * ySpeed2);
// calculate motion vectors
double[] p1Trajectory = {xSpeed1, ySpeed1};
double[] p2Trajectory = {xSpeed2, ySpeed2};
// Calculate Impact Vector
double[] impactVector = {xPosition2 - xPosition1, yPosition2 - yPosition1};
double[] impactVectorNorm = normalizeVector(impactVector);
// Calculate scalar product of each trajectory and impact vector
double p1dotImpact = Math.abs(p1Trajectory[0] * impactVectorNorm[0] + p1Trajectory[1] * impactVectorNorm[1]);
double p2dotImpact = Math.abs(p2Trajectory[0] * impactVectorNorm[0] + p2Trajectory[1] * impactVectorNorm[1]);
// Calculate the deflection vectors - the amount of energy transferred from one ball to the other in each axis
double[] p1Deflect = { -impactVectorNorm[0] * p2dotImpact, -impactVectorNorm[1] * p2dotImpact };
double[] p2Deflect = { impactVectorNorm[0] * p1dotImpact, impactVectorNorm[1] * p1dotImpact };
// Calculate the final trajectories
double[] p1FinalTrajectory = {p1Trajectory[0] + p1Deflect[0] - p2Deflect[0], p1Trajectory[1] + p1Deflect[1] - p2Deflect[1]};
double[] p2FinalTrajectory = {p2Trajectory[0] + p2Deflect[0] - p1Deflect[0], p2Trajectory[1] + p2Deflect[1] - p1Deflect[1]};
// Calculate the final energy in the system.
double p1FinalMomentum = Math.sqrt(p1FinalTrajectory[0] * p1FinalTrajectory[0] + p1FinalTrajectory[1] * p1FinalTrajectory[1]);
double p2FinalMomentum = Math.sqrt(p2FinalTrajectory[0] * p2FinalTrajectory[0] + p2FinalTrajectory[1] * p2FinalTrajectory[1]);
// Scale the resultant trajectories if we've accidentally broken the laws of physics.
double mag = (p1InitialMomentum + p2InitialMomentum) / (p1FinalMomentum + p2FinalMomentum);
// Calculate the final x and y speed settings for the two balls after collision.
xSpeed1 = p1FinalTrajectory[0] * mag;
ySpeed1 = p1FinalTrajectory[1] * mag;
xSpeed2 = p2FinalTrajectory[0] * mag;
ySpeed2 = p2FinalTrajectory[1] * mag;
}
/**
* Converts a vector into a unit vector.
* Used by the deflect() method to calculate the resultant direction after a collision.
*/
private double[] normalizeVector(double[] vec)
{
double mag = 0.0;
int dimensions = vec.length;
double[] result = new double[dimensions];
for (int i=0; i < dimensions; i++)
mag += vec[i] * vec[i];
mag = Math.sqrt(mag);
if (mag == 0.0)
{
result[0] = 1.0;
for (int i=1; i < dimensions; i++)
result[i] = 0.0;
}
else
{
for (int i=0; i < dimensions; i++)
result[i] = vec[i] / mag;
}
return result;
}
If you are interested in knowing more about how and why the above algorithm works, please study
the Wikipedia article here.
SCC110: Software Development Term 3. Programming Project.
Start-up tasks:
These tasks are to be completed in your Week 21 practical in order to give you some momentum
into the development of the game.
1. Carefully read the project requirements and watch the video of Air Hockey in action. Study
the JavaDoc documentation and make notes of the methods defined in each class.
2. Develop a design plan. Decide if one (or more) of the given classes need to be extended,
while the remaining classes can remain unchanged. Contemplate how the given classes can
be used to compose new classes that will facilitate development of the game. Think what
methods these classes should contain and how they would interact with each other.
Remember that your code should adhere to the principles of object-oriented programming.
3. Identify project stages and develop a testing plan for each stage. For example, when
development of the Air Hockey table has been completed, test the movement of the two
blue mallets (in the absence of a puck); then, check if the puck properly bounces off the
cushions (in the absence of mallets).
Marking Scheme:
Marks will be awarded according to the marking scheme shown at the start of this document. Marks
for the ‘Functionality’ section will be awarded based on individual merit, but the following table
gives an indicative overview of the level of functionality expected for each grade band:
A: Working program that meets the criteria for a B, plus:
- Includes sound effects for the start of a new set of games, deflections, bounces,
goal celebrations and winner announcements. Sound can be turned on and off.
- Implements deflections between the black puck and the blue mallets in an accurate
way based on physics.
- Detects when a player wins the game, including the final score and an option for
players to play again.
- Allows the use of cheating codes. (Use your imagination!)
B: Working program that meets the criteria for a C, plus:
- Increases the score of a player who hit the black puck into the other player’s goal.
- Increases the score of a player, when the other player puts the black puck into
their own goal.
- Implements deflections between the black puck and the blue mallets in an
accurate way based on physics.
- Includes sound effects for the start of a new set of games, deflections, bounces,
goal celebrations and winner announcements.
C: Working program that meets the criteria for a D, plus:
- Implements deflections between the black puck and the blue mallets in a basic way
(i.e., physics equations are not considered).
- Accurately bounces the black puck off cushions.
- Decelerates the puck due to friction.
SCC110: Software Development Term 3. Programming Project.
D: Working program that:
- Shows a viable Graphical User Interface (GUI).
- Displays the black puck and the blue mallets at the appropriate start locations.
- Permits each player to move their mallets in a user-friendly way.
F: No working program demonstrated, or program does not meet any requirements listed
above.
SCC110: Software Development Term 3. Programming Project.
Project Title: Project 3: The Hitchhiker’s Guide to Plagiarism Checking
Language: Either Java or C
Project Overview:
Throughout academia computerised plagiarism checkers are used to gather information about the
originality of students’ work. This practice gives an indication of whether any of the work’s content
has been taken from an external source (whether web-based or from another student) and provides
that information in a form that the instructor can interpret.
Your task is to create a simple plagiarism checker to check a group of text files against one another.
Five text files (based on a section of The Hitchhiker’s Guide to the Galaxy by Douglas Adams) have
been provided for you to check as examples. Your program should be capable of providing an
analysis of the content of each file, and a measurement of similarity between each pair of files.
These results should then be displayed in a user-friendly form, appropriate to the programming
language you have chosen. The results can be text based such as generating HTML files that can be
viewed within a web browser (though you should still make an effort to make the display as
readable as possible). Alternatively, if you prefer, your results could be displayed on a graphical user
interface.
There are two commonly used metrics to determine similarity between two documents – word
frequency and phrase matching. Together these can provide an effective indication of similarity.
Word Frequency:
Word frequency is simply a count of the number of occurrences of each and every unique word
within a given document. This should exclude all punctuation and ignore any capitalisation and
whitespace. For example, the word frequency analysis for two given sentences is shown below:
Sentence 1: The Vogons destroyed the Earth.
Sentence 2: Arthur Dent lived on the Earth.
Sentence1 Sentence2
the 2 1
vogons 1 0
earth 1 1
destroyed 1 0
on 0 1
arthur 0 1
dent 0 1
lived 0 1
Table 1 - Example Word Frequency Analysis
SCC110: Software Development Term 3. Programming Project.
Phrase Matching:
Word frequency analysis provides a simple indication on the individual words used in a set of
documents but pays no attention to the ordering of them within a file. By considering their spatial
proximity, we can also determine if those words are used in a similar way, hence have greater
similarity.
Phrase matching is the process of detecting a consecutive set of matched words within two given
documents. The minimum length of a phrase to detect is user definable. The measure of similarity
between two files can therefore be provided as a percentage match, given by: The number of
phrase-matched words / The total number of words.
As with word frequency analysis, capitalisation, punctuation and whitespace should be ignored.
Ideally, the count of matched words should also exclude words that are contained within quote
marks, as valid citations of an external reference.
For example, given two sentences:
Sentence 1: It is an important and popular fact that things are not always what they seem.
Sentence 2: It is well recognised that things are not always what they seem.
Phrase Match: 67%
Results Visualisation:
The results for each file should be displayed with a ranked list of other files according to their
percentage match. For example, table 2 shows the results for file 1 (left) and file 2 (right). There
should also be a list of the top overall matches, which can be seen in table 3.
Pair Phrase Match (%) Pair Phrase Match (%)
File 1 – File 3 54 File 2 – File 4 43
File 1 – File 4 31 File 2 – File 5 29
File 1 – File 5 23 File 2 – File 3 14
File 1 – File 2 12 File 2 – File 1 12
Table 2 Ranked list of matches for a given file
Pair Phrase Match (%)
File 1 – File 3 54
File 2 – File 4 43
File 1 – File 4 31
File 2 – File 5 29
Table 3 Ranked highest overall matches
Selection of one of these pairs should provide the user with both the details of the phrase matching
and the word frequency analysis.
SCC110: Software Development Term 3. Programming Project.
Project Requirements:
- You should calculate the word frequency for each of the five documents provided.
- You should display the word frequency result from a given pair of files side by side, and rank
words according to frequency.
- You should set the threshold for the number of consecutive words for a phrase match.
- You should calculate the phrase match percentage for each pair of files using the given
threshold.
- You should be able to display results for each pair of files that include both word frequency
and phrase match.
- You should also provide a visualisation of the overall results.
Guidance:
▪ Opening files and parsing strings… remember, much of the C work in the first term
concentrated on opening files and manipulating strings, if you’re not sure where to start,
those old exercises and the lecture notes are a great way to get going. Once you can read in
files and recognise individual words you’re in a position to work on the rest, but not before.
Remember string.h. Even if you’re working in Java, a quick look through your Term 1 C work
is still a good idea, as the concepts are much the same. If you haven’t read from a file before
in Java, try reading up on the BufferedReader class, this will allow you to read in from a file
one line at a time. Similarly, it might also be a good idea to look up the StringTokenizer class.
▪ Think about your design… In C, your program might be improved (certainly simplified) using
structs. Remember that structs are a lot like classes in java, though they don’t include any
methods – just variables. A simple example using structs can be found here:
https://www.tutorialspoint.com/cprogramming/c_structures.htm. In Java, of course, you
will need to spend time thinking about what classes you’ll need, as your program will be
greatly improved if you make use of the class structure to store your data.
▪ Word frequency… If you’re not sure how the frequency of words might work, try reading
around for some ideas. There are some suggestions on these sites:
https://en.wikipedia.org/wiki/Bag-ofwords_model, https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_alg
orithm
▪ Visualisation and phrase matching… This guide to Turnitin, a prominent plagiarism checking
tool online, provides more ideas on what type of functionality this your program could
provide when you’re looking to create webpage visualisations or extend your work:
https://help.turnitin.com/feedback-studio/turnitin-website/student/the-similarityreport/interpreting-the-similarity-report.htm
SCC110: Software Development Term 3. Programming Project.
Marking Scheme:
Marks will be awarded according to the marking scheme shown at the start of this document. Marks
for the ‘Functionality’ section will be awarded based on individual merit, but the following table
gives an indicative overview of the level of functionality expected for each grade band:
A: Working program that meets the criteria for a B, plus:
- Either Create several linked webpages to display the results
- Or provides an interactive GUI
- Provides highlighted text to show where matched phrases were
- Allows the user to look up the frequency of any word in any file
B: Working program that meets the criteria for a C, plus:
- Compares each of the five files word by word using phrase matching with a
settable length of phrase
- Ignores matches in quote marks
- Ranks the results from the comparison
- Displays the results on screen effectively
C: Working program that meets the criteria for a D, plus:
- Analyses the frequency of words in each file
- Removes punctuation, whitespace, newlines and quote marks from text
- Displays that information
D: Working program that:
- Reads in all five files
- Tokenises (creates a list of words from) the contents of the files
F: No working program demonstrated, or program does not meet any requirements
listed above.