RMIT Classification: TrustedProgramming Fundamentals (COSC2531)
Final Coding Challenge
Assessment Type Individual assessment (no group work).Submit online via Canvas/Assignments/Final Coding Challenge.Marks are awarded per rubric (please see the rubric on Canvas).
Clarifications/updates may be made via announcements.Questions can be raised via the Canvas discussion forum.Due Date
End of Week 14 (exact time is shown in Canvas/Assignments/Final CodingChallenge) Deadline will not be advanced nor extended. Please checkanvas/Assignments/Final Coding Challenge for the most up to dateinformation regarding the assignment.As this is a major assignment, a university standard late penalty of 10% (i.e.,3 marks) per each day applies for up to 5 days late, unless specialconsideration has been granted.
Weighting
30 marks out of 100
- Overview
The main objective of this final project is to assess your capability of program design andimplementation for solving a non-trivial problem. You are to solve the problem by designing a numberof classes, methods, code snippets and associating them towards a common goal. If you have questions,please ask via the relevant Canvas discussion forums in a general manner; for example, you shouldreplicate your problem in a differentcontext in isolation before posting, and you must not post yourcode on the Canvas discussion forum.
- Assessment Criteria
This assignment will determine your ability to:Follow coding, convention, and behavioural requirements provided in this document and inthe course lessons;Independently solve a problem by using programming concepts taught in this course;Design an OO solution independently and write/debug in Python code;Create a program by recalling concepts taught in class, understand and apply conceptsrelevant to solution, analyse components of the problem, evaluate different approaches.PageRMIT Classification: Trusted
- Learning Outcomes
This assignment is relevant to the following Learning Outcomes:
- Analyse simple computing problems.
- Devise suitable algorithmic solutions and code these algorithmic solutions in a computer
programming language (i.e., Python).
- Develop maintainable and reusable solutions using object-oriented paradigm.
- Assessment Details
Please ensure that you have read Sections 1-3 of this document before going further.Problem Overview: In this final coding challenge, you are asked to develop a Python game programwith the Object-Oriented Programming paradigm, that is based on recently popular Japanese animevirtual pet game, named pymon.py, that can read data from files and perform operations and
simulate interactions with users. You are required to implement the program following the belowrequirements. Note that we will give you some filesfor you to run with your developed program,BUT you should change the data in these files to test your program. During the marking, we willuse different data/files to test the behavior of your program.Game objective: Pymon is an imaginary creature that you can adopt as a pet. In the game map,
there will be two kinds of creatures: Pymon and animal. Only a Pymon can be captured and adopted
as a pet. Initially, you control a Pymon to scroll through a map of interconnected locations with themission to find other creatures to defeat in a battle of “rock, scissor, paper” encounter. The goal isto be able to find all the creatures located in various rooms before your Pymon runs out ofenergy.Once your Pymon defeats a creature, it will be captured and added to your pet list and can be usedto help win your mission. If your Pymongot defeated by another creature, one代写COSC2531 Programming Fundamentals energy point will bededucted. Once you run out of all energies, then you will lose your Pymon and it will wildly moveto random location. If you hold an extra Pymon, this will become active. If this was your only andlast Pymon, then it is game over. You will win the game once there is no longer any capturable
creature on the map.
Requirements: Your code must meet the following functionalities, code, and documentation requirements. Your submission will be graded based onthe rubric published on Canvas. Please ensure
read all the requirements and the rubric carefully before working on your assignment.
A - Functionalities Requirements:
There are 4 levels, please ensure you only attempt one level after completing the previous level.
------------------------------------------- PASS LEVEL (12 marks) --------------------------------------
Your project is to implement the required functionalities in the Object-Oriented (OO) style with at
least four classes: Locations, Pymon, Record, and Operation. You need to design appropriatestatic/instance variables, constructors, and static/instance methods in these classes. The class related
info should be encapsulated inside the corresponding class.The goal of this level is to first construct a map that contains multiple interconnected locations.Class LocationPage
Location represent a placeholder for your Pymon to interact with other creatures and items. It will beisted in a map and interconnected with each other through a door. Every location has all directions“west”, “north”, “east”, and “south”, however not every direction will lead you to another room. InYour Pymon can move to another location by going by one of these directions. Every location will be
connected to at least 1 other location adjacent to it. If the location is connected on the west side, thenthe adjacent location will be connected to it on the east side. The suggested class implementation is afollows:
Location should have 4 attributes:
- Name. Short name of the location.
- Description. Short description of the location.
- Doors. A dictionary of connected locations in each direction “west”, “north”, “east”, “south”. Initially
all doors will be assigned None as its initial value. None simply means there is no location currently
exists in that direction.
- List of creatures. List of creatures that resides in it. Initially there will be None.
- List of items. List of items that it holds. Initially there will be None.
Location should also have:
- A constructor
- Relevant getter and setter methods
- Connect method: This will assign an available direction with another ‘location’. Consequently the
method should take in two parameter arguments: direction and location. It will add the other location
in the list of connected location. At the same time, it will set the current room in its list of list of
connected locations. Example use case of this method:
o school.connect(“west”, playground) connects playground on school’s west side and connect
school on playground’s east side.
o Alternatively, you could have a connect method that takes in the location name for each
direction, e.g. connect_west(“playground”)
After the map is done, another objective of this level is to instantiate the game’s objects and to perform
basic operations to interact with the game character called Pymon. You will have a Pymon named
‘Kimimon’, which is a white and yellow Pymon with a square face to begin with.
Class Creature
Creature can be found throughout the map and it has 3 basic attributes:
- Nickname: Each creature will have a unique name.
- Description: Each creature will have a brief description such as “large blue and white Pymon with
yellow fangs.”
- Location: This will contain object reference of its current location.
A normal Creature cannot be challenged or adopted.
Class Pymon Pymon is an inheritance of Creature that has an additional attribute:Page
RMIT Classification: Trusted
- Energy: Initially there are 3/3 energy points. There are factors that will increase and decrease energyBesides a constructor, relevant setter, and getter methods, Pymon will also have this ability. Moreabilities will be added in later stage.
- Move: This will take in a ‘direction’ parameter argument. The acceptable keywords are “west”, “north”,“east”, and “south”. If there is a connected location in that direction, then the Pymon will move to newlocation, otherwise it will not do anything and stay in the current location.Class Record
At the pass level, you are required to import two input files: locations.csv and creatures.csv and loaddata to relevant location and creatures lists.Class Operation The object instantiated from Class Operation would provide menu option that links with a relevant
method of another object.At this level the program would have the following menu options to operate Pymon.
- Inspect Pymon
This is to review Pymon’s biodata, energy, and game statistics.
- Inspect current location
This will provide information about your Pymon current location including location name and
description, creatures that reside in it and items. It can only work when your Pymon is currently located
in this location. To get description of another location you must try and move Pymon to another location.
- Move
This option will command Pymon to move from its current location to an adjacent location by entering
a direction’s door namely “west”, “north”, “east”, and “south”. If there is no door in that direction, then
Pymon cannot enter the location in that direction and will remain in the current location.
- Exit the program
Initial environment setup
At this level, the following initial setup will be required and tested.
- There will be 3 interconnected locations:
- Playground {west = School, north = Beach, east = None, south = None}
- Beach {west = None, north = None, east = None, south = Playground}
- School{west = None, north = None, east = Playground, south = None}
There are more locations in the csv file, but at the P level you only need the above 3 locations which
are manually connected by calling relevant connect methods.
- Your Pymon will be spawned (placed) in the school initially.
- The following creatures are spawned in the following locations:
- Playground contains “Kitimon”.
- Beach contains “Sheep”.
- School contains “Marimon”.
- The rest of the creatures in the file will not be used at this stage.Page
When the game starts, the following output appears:
Sample output of the program at this level for inspecting current location is as follows:Page
7of19RMIT Classification: Trusted
ample output of the program at this level for moving is as follows:
----------------------- CREDIT LEVEL (5 marks, you must only attempt this level after
completing the PASS level -------------------------
At this level, you will implement 2 additional menu items:
- Pick an itemThis option will command Pymon to attempt to pick up an item. Every location may be decorated withitems that Pymon can interact with. Some items can be picked and some cannot. Pymon can only pick
an item if it is currently located in the same location as the item. When item is picked up, it will movedfrom the location to Pymon inventory, that means the item will be removed from its original location.
- View inventoryThis is to review items picked up along the journey. At later stage, each item in the inventory can be
Item list The following items may be found in a location. At the Credit level, there is only 1 item of each type.
- Apple. Apple is Pymon’s main food, which can be picked up and eaten to replenish Pymon’s energy.Apple can only be used once.
- Magic potion. This can be picked up and when applied, the pet will have immunity during a battle. Thatis if it loses in battle, is energy will not be deducted, and it will be given a chance to try battle onceagain. Magic potion can only be used once.
- Binocular. With the binocular, Pymon can get an extra ability to quickly review of its surroundingsincluding the location names in all directions. Additionally, a binocular also provides a foresight of adirection.
- A tree. A tree does nothing and cannot be picked up. It is there for decoration purpose.Initial Setup
Your game intial set up will now have the following items placed in the following locations:
- Playground contains a ‘tree’ and a ‘magic potion’.
- Beach contains ‘apple’.
- School contains ‘binoculars’.All of the location should now be dynamically connected to each other as per the supplied locations.csv file. Each line in the file that contains name, description, west, north, east, south must be
programmatically read and translated as an object that goes into list of locations with properconnections.Your Pymon starting location should be randomised from this level onwards.Additionally, at this level, you will implement an additional menu item called “Challenge acreature”, which sends the Pymon to enter a battle mode against the other creature that are located at
the same location as yours. The battle is based on a traditional children game called “rock, scissor,paper”, in which each side would present one of three shapes at the same time.A battle will consist of maximum 3 encounters or as many as the energy points that your Pymon has.n each encounter you select and issue one of the three available shapes, and your opponent will
andomly issue their selected shape immediately afterwards. Both issued shapes will be comparedand assessed based on the following rules to determine the winner of each encounter.
Scissor wins (you win)Page9of19RMIT Classification: TrustedThe battle follows ‘best of three encounters’, that means, the first player to win 2encounters will withthe battle.Ifthere is a draw, then the encounter will be repeated until there is a winner. If your Pymonloses an encounter, its energy level will decrease by 1 point. Once your energy level reached zero oryou got beaten in 2 encounters (whichever comes first) then, you have lost the battle and mustrelinquish your Pymon into the wild and it will be randomly moved into another location. If you haveanother Pymon in your pet list, then this will become your current Pymon. All items in the inventoryget transferred into your new Pymon’s iventory. But if your one and only Pymon was taken away, thenit is game over. If your Pymon wins against itsopponent, then you would capture collect the opposingPymon as a pet to be added to your pet list.
To implement the above, Class Pymon needs to be modified to include the following additionalmethod:
- Challenge: This will take in a ‘creature_name’ parameter argument. If there is another Pymon as a
potential opponent in the location, your Pymon can challenge the opponent to go into battle of “rock,paper, scissor” encounter. While Pymon canbe challenged, other creatures cannot.
he menu will now look as follows:
- Inspect Pymon (this menu item now has 2 sub items)
- Inspect current Pymon: View your current Pymon’s name, description, and energy.
- List and select a benched Pymon to use. If another Pymon is available in the bench you
can swap it with your current one. Items in the current inventory will stay with the Pymonwho picked them up, until you lose this Pymon in a battle.
- Inspect current location
- Move
- Pick an item
- View inventory
- Challenge a creature: This will send your Pymon into a battle mode against another Pymon in the
current location. If there is no other Pymon in the location, then the challenge is invalid and will not
affect anything. Attempt to challenge a creature other than a Pymon will result in something silly like
“the sheep just ignored you” or “the chicken just laughed at you”.
- Exit the programPage
----------- DI LEVEL (5 marks, you must only attempt this level after completing the CREDIT level) --------------- This level further extendsyour program with extra features and complexities.Pymon energy level can go up and down.
- Energy level increases by one point if Pymon eats an edible item.
- Energy level decreases by one point in every 2 moves. When Pymon moves 2 locations, it’s energy
will decrease by 1 point. Once all energy points were depleted, your Pymon will escape into the wildand moved to a random room. If this this wasyour one and only Pymon, then it is game over.At this level Pymon can use items in the inventory to help its mission and maintain its energy level.Make the following modification in Class Pymon:
Use item: This will take in an ‘item’ parameter argument to use an item in the inventory. An item mustfirst be collected and added in inventory before it can be used.o If there is an edible item like an ‘apple’, then Pymon can eat it. Each item will increase energyby one point. Maximum energy is 3. If current energy level is already 3, then eating will notfurther increase energy.
o A ‘magic potion’ will give temporary immunity in a battle. The potion can only be used in one
battle. While the potion is used, if your Pymon wins the encounter, this magic potion remains.If your Pymon lose the encounter, energy will not getdeducted and the magic potion willdisappear from the inventory. Regardless of the battle outcome, after the battle, the potion willdisappear from the inventory.
o A ‘binocular’ will give Pymon farsighted vision of the current location and other connected
location in a particular direction. When using binocular, Pymon can select from the following
options:
▪ “current”. Example output “A sheep, another Pymon, and in the west is a cave”.
▪ “west”. Example output “In the west, there seems to be a cave with an edible apple andanother unknown creature nearby”.
▪ “north”. Example output “This direction leads nowhere”
▪ “east”. Example output “This direction leads nowhere”.
▪ “south”. Example output “This direction leads nowhere”The menu will now look as follows:
- Inspect Pymon
- Inspect current location
- Move
- Pick an item
- View inventory (this function now has an additional sub-command)
- Select item to use
- Challenge a creature
- Generate stats
- Exit the programAdditionally, your program should now be able to handle some variations in the files using builtin/custom exceptions:Page13of19RMIT Classification: Trusted
- InvalidDirectionException: This exception gets thrown when the selected direction does not containany location.
- InvalidInputFileFormat: This exception gets thrown when a CSV file has invalid content or in incorrectformat.
-------------- HD LEVEL (5 marks, you must only attempt this level after completing
the DI level) ---------------
The menu will now look as follows:
- Inspect Pymon
- Inspect current location
- Move
- Pick an item
- View inventory
- Challenge a creature
- Generate stats
- Exit the programAdditional information will be saved:
- Every battle will now be noted in statistic. This will now include number of wins, number of draw, andnumber of losses of every Pymon that you had control of. At the bottom of the battle list, it will showtotal wins, total draws and total loss. For example:Pymon Nickname: “Marimon” Battle 1, 25/10/2024 11:22AM Opponent: “Gumimon”, W: 2 D: 1 L:1
Battle 2, 26/10/2024 10:30PM Opponent: “Pumamon”, W: 2 D: 0 L: 0 Total: W: 4 D: 1 L: 1
- Every encounter will be given a timestamp that contains actual date and time of the battle.
There are 3 data files that will provide the starting materials to run the game: creatures.csv,locations.csv and items.csv. Data from these 3 should be added to corresponding lists in a Recordobject. As the program gets more complex, it allowsfor custom files input to provide extension andextra variations to the game. For this you may add an additional Record class to manage file input andoutput. NOTE, your code must be able to run under command-line as in the specification. Specifically,
if the filenames of the locations, creatures, and items are locations.csv, creatures.csv, and items.txt,respectively, then your program should be able to run under the following command lines:
- python pymon_game.py
- python pymon_game.py locations.csv
- python pymon_game.py locations.csv creatures.csv
- python pymon_game.py locations.csv creatures.csv items.csv
After data were imported into the program, the program will place items and creatures at variouslocations randomly. At this stage, there could be more than one item in various locations. Your Pymonstarting location will also be randomised.Page14of19RMIT Classification: Trusted
The program will have some additional requirements (some might be challenging):
- Save game progress: This will save state of the game in a custom file like save2024.csv
- Load game progress: This will load state of the game in a custom file like save2024.csv
- Admin feature to add a custom location. This is to create a new location object and save it inlocations.csvSample csv line that represents a location is as follows:School, a secondary school for local creatures with 3 two-story buildings., None, None, Playground, None
- Admin feature to add a custom creature. This is to create a new creature object (could be bothPymon and other type of creature) and save it in creatures.csv. You may decide to have aninheritance structure to categorise a Creature into 2 categories: Pymon and Animals.Sample csv may contain name, description, and adoptable (yes/no) such as the following:Kitimon, large blue and white Pymon with yellow fangs, yes Sheep, small fluffy animal with interesting curly white fur, no Marimon, medium red and yellow Pymon with a cute round face, yes
- Admin feature to randomise connections between locations. Once imported, the location now
will ignore the connected locations defined in the CSV file. Instead, each side of the locationwill now be assigned a random location to increase the game’s unpredictability. Similar to the
initial setup not all sides would have a connecting door, i.e. will be assigned None.Page15of19MIT Classification: Trusted
B - Code Requirements:
You must demonstrate your ability to program in Python by yourself, i.e., you should not use anPython packages that can do most of the coding for you. The only Python packages allowed in this
assignment are sys, os, datetime, csv and random. If other packages/libraries are used, you will get
a heavy penalty.
Your program at all levels should be fully OO, e.g., no variables, methods, or code snippets danglingoutside a class. Your main program should simply create an object and run its methods to invokemethods from other classes to perform the required functionalities.
You should test/verify the program with different text files (not just run with our text files) toensure your program satisfies all the required functionalities.You are not allowed to use Artificial Intelligence tools (e.g., ChatGPT or Copilot) to help you
when developing your code. If this is detected by our plagiarism checker, a plagiarism/misconductcase will be open for you, and you will be reported to the RMIT Misconduct team who will then handleyour plagiarism/misconduct case.Your code needs to be formatted consistently. You must not include any unused/irrelevant code (eveninside the comments). What you submitted must be considered the final product.You should design your classes carefully. You may use a class diagram to assist with the design. In
the DI and HD levels, you are required to provide a detailed class diagram to show your class
design. An example of a class diagram is shown below – Figure 1 (note that this is a class diagram of
a different programming assignment). In the diagram, the variables and methods of each class are
shown. Note that if your code is at the PASS or CREDIT level, you do not need to submit any diagram;
a diagram at these levels would NOT result in any mark.
You could use tools like PowerPoint, Keynotes, or online tools like moqups.com to draw the diagram.
The diagram needs to be submitted in jpg, gif, png, or pdf format.
Finally, note that in places where this specification may not tell you how exactly you should implement
a certain feature, you need to use your judgment to choose and apply the most appropriate concepts
from our course materials. You should follow answers given by your "client" (or "supervisor" or the
teaching team) under Canvas/Discussions/Discussion on Final Coding Challenge.Page16of
19RMIT Classification: TrustedFigure 1. An example of a class diagramC - Documentation Requirements:
You are required to write comments (documentation) as a part of your code. Writing documentationis a good habit in professional programming. It is particularly useful if the documentation is next tothe code segment that it refers to. NOTE that you don't need to write an essay, i.e., you should keepthe documentation succinct.
Your comments (documentation) should be in the same Python file. Please DO NOT write a
separate file for comments (documentation).
At the beginning of your Python file, your code must contain the following information:
- Your name and student ID.
- The highest level you have attempted. This means you have completed all the requirements
of the levels below. Mark will be only given at the lowest level of partial completion. Forexample, if you completed the PASS level, tried 50% of the REDIT level, 30% of the DIlevel, 10% of the HD level, then your submission will be marked at the CREDIT level only
(we will ignore the DI and HD levels, so please make sure you fully finish one level beforemoving to the next one).Any problems of your code and requirements that you have not met. For example,scenarios that might cause the program to crash or behave abnormally, the requirements your Pag
program does not satisfy. Note that you do not need to handle or address errors that are notcovered in the course.Besides, the comments in this final coding challenge should serve the following purposes:
Explain your code in a precise but succinct manner. It should include a brief analysis of yourapproaches instead of simply translating the Python code to English. For example, you can
omment on why you introduce a particular function/method, why you choose to use a while
loop instead of other loops, why you choose a particular data type to store the data information.
These comments can be placed before the code blocks (e.g., functions/methods, loops, if) andimportant variable declarations that the comments refer to.
- Document some analysis/reflection as a part of your code. Here, you need to write someparagraphs (could be placed at the end or at the beginning of your code) to explain in detailyour design process, e.g., how you came up with the design of the program, how you startedwriting the code after the design process, the challenges you met during the code development.
- Document the references, i.e., any sources of information (e.g., websites) you used other than
the course contents directly under Canvas/Modules, you must give acknowledgement of the
sources, explaining how you use the sources in this assignment. More detailed informationregarding the references can be found in Section 5.
5HD level5Others: Overall Class Diagram1Others: code quality, modularity, comments/analysis2More details of the rubric of this assessment can be found onCanvas (here). Students are required to
ook at the rubric to understand how the assessment will be graded.
- SubmissionAs mentioned in the Code Requirements, you must submit only one zip file with the name
ProgFunFinal_<Your Student ID>.zip via Canvas/Assignments/Final Coding Challenge. The zip
file contains:
- The main Python code of your program, named pymon_game.py
- A diagram in one of the formats: jpg, gif, png, pdf (if you attempt the DI and HD levels)
- Other Python files written by you to be used by your main application.
It is your responsibility to correctly submit your file. Please verify that your submission is correctly
submitted by downloading what you have submitted to see if the file includes the correct contents. Thefinal zip file submitted is the one that will be marked. You do not need to submit the text files we
provide you with – we will mark based on our text files. If you attempt the PASS level, your programshould be able to run the first and second command lines. If you attempt until the CREDIT level, yourprogram should be able to run the first, second, and third command lines. If you attempt until the DIor HD level, your program should be able to run all the four command lines. NOTE, the filenamesPage
RMIT Classification: Trusted
specified in the command lines can be different, not necessarily locations.csv, creatures.csv, items.csv. You can assume users always specify the correct order of file names, i.e., the locations filefirst, the creatures file second, and the items file third.
Late Submission
All assignments will be marked as if submitted on time. Late submissions of assignments withoutspecial consideration or extension will be automatically penalised at a rate of 10% of the total marksavailable per day (or part of a day) late. Forexample, if an assignment is worth 30 marks and it issubmitted 1 day late, a penalty of 10% or 3 marks will apply. This will be deducted from the assessedmark. Assignments will not be accepted if morethan five days late unless special consideration or anxtension of time has been approved.
Special Consideration
If you are applying for extensions for your assessment within five working days after the originalassessment date or due date has passed, or if you are seeking extension for more than seven days, youwill have to apply for Special Consideration, unless there are special instructions on your EquitableLearning Plan.In most cases you can apply for special consideration online here. For more information on specialconsideration, visit the universitywebsite on special consideration here.
- Referencing GuidelinesWhat: This is an individual assignment, and all submitted contents must be your own. If you haveused sources of information other than the contents directly under Canvas/Modules, you must giveacknowledgement of the sources, explaining in detail how you use the sources in this assignment,and give references using the IEEE referencingormat.Where: You can add a code comment near the work (e.g., code block) to be referenced and includthe detailed reference in the IEEE style.
How: To generate a valid IEEE style reference, please use the citethisforme tool if you're unfamiliarwith this style.Academic Integrity and Plagiarism (Standard Warning)Academic integrity is about honest presentation of your academic work. It means acknowledging thework of others whilst developing your own insights, knowledge, and ideas. You should take extremecare that you have:
- Acknowledged words, data, diagrams, models, frameworks and/or ideas of others you havequoted (i.e., directly copied), summarized, paraphrased, discussed, or mentioned in yourassessment through the appropriate referencing methods.
Provided a reference list of the publication details so your readers can locate the source ifnecessary. This includes material taken from the internet sitesIf you do not acknowledge the sources of your material, you may be accused of plagiarism becauseyou have passed off the work and ideas of another person without appropriate referencing, as if theywere your own.Page19
of19RMIT Classification: TrustedRMIT University treats plagiarism as a very serious offence constituting misconduct. Plagiarismcovers a variety of inappropriate behaviors, including:
- Failure to properly document a source
- Copyright material from the internet of databases
- Collusion between studentsFor further information on our policies and procedures, please refer to the University website (link).assessment