Requirements
You are required to design and implement an application model for a platformer video game Stickman. The video game consists of a character on the screen, can move left,
right and has the ability to jump. The character will interact with the world, have a floor to stand on, obstacles to interact with (bounce, hit, ..) and maintain a score.
You will need to ensure that your application is configurable with a JSON text file, allowing configuration of the main character’s size, background cloud velocity. You
are given an example JSON file format.
In assignment , you are going to test, review and extend an existing implementation
of ‘Stickman’ (that is not your own) to add features, leveraging your knowledge of OOP and design patterns. Please find the detailed tasks below:
Implementation Task
What we provide to you?
• Codebase: the codebase is provided to you.
Please note that, your goal is to extend and maintain this implementation. What this
means is to add features to the existing implementation by using OO design principles
and appropriate patterns you have learnt throughout, without breaking the
implementation (it runs – rule #1 is don’t break working code) or using unnecessary
‘hacks’.
You are not required to correct the existing design of the implementation – you must retain the existing design wherever changes are not required and will be penalised
(for example, replacing the given
should this be changed without cause
implementation with your own code). The idea here is that you work with the existing design rather than against it, and minimise required changes to the existing structure (reasonable, limited scope refactoring to support extensions is encouraged).
What we expect from you?
Testing
You are required to write JUnit 4 tests for the code provided to you. These tests must
cover the functionality of each class and must be runnable using ‘gradle test’ (included
in ‘gradle build’). Ensure your test cases cover and cover both common and edge/corner cases.
Extension
Your stickman game is now expected to support the following 3 features in your code:
over 90% of execution paths
• Level Transition
o moving from level 1 to n (n>=3), then showing ‘Winner’ when level n is
completed as the stickman achieves the goal (finish flag touched).
o These levels can either be contained within the same configuration file, or you
can use multiple configuration files.
• Score and Time
o The game must record and display the time elapsed for the current level since
the start of the level until the stickman has touched the finish flag of this level.
o Each level has a target time, which needs to be set in the configuration file. For every 1 second below this time, there is 1 point added into the score;
whereas for every 1 second over this time, there is 1 point deducted from the score. There are 100 points added into the score per enemy shot. There are 50
points added into the score per mushroom touched by stickman.
o Stickman now has more than one life displayed, which needs to be set in the configuration file. Losing a life does not impact points. The minimum score is
0. If all lives lost, the game is over with showing ‘Game Over’.
o The game must record and display on the screen an updating score. You must display the current level’s score (initial is 0) on screen during the level (which will visibly be counting down to 0), as well as the total score for all previous levels.
• Save and Load
o The player must be able to save the state of the game (quicksave), then reload
that saved game at any point in time (quickload).
o The full state of the game must be reverted to the saved state at that time
(including Level, Score, and all Entities).
o This must be a single saved state that is not written to disk, and each
subsequent quicksave overwrites the existing saved state.
o Quickload reverts the game state to the single saved version. This should be
controlled using keyboard keys (e.g. q and s).
Your code submission will be divided into two parts, including testing part and
extension part.
Report Task
Your report in this assignment must concisely cover the followings:
1. Code review on the existing codebase provided to you, which includes
o discussion on the use of OOP design principles (be specific to the given code,
a UML snippet would be helpful)
o discussion on the use of design patterns (be specific to the given code, a UML
snippet would be helpful)
o discussion on the documentation (e.g., readme file, comments, etc.)
o discussion on how easy or difficult the above made it to achieve your required functionality and the reason
2. A discussion on your feature extension including
o Describe the actual extension you have made in your code
o Highlight your application of OO design principles in your extensions and
explain what they motivated you to do and why (be specific to your code, a UML snippet would be helpful)
o Document any design patterns used and rationalise their usage in terms of SOLID and GRASP (be specific to your code, not the pattern in general, a
UML snippet would be helpful)
o Reflect on your extension design, highlighting any outstanding issues or
improvements or discussing your impact on the extensibility of the code
3. A UML class diagram of the after-extension version of your codebase,
highlighting the design patterns you have used for your extension and identifying
the participants in each design pattern you have used. 4. Any acknowledgement/reference required.