4CS001 : INTRODUCTORYPROGRAMMING AND PROBLEM SOLVING
Table of Contents
4CS001-Coding Challenge4
IndividualProgrammingProject
This assignmentis worth40%oftheoverallmodulegrade
Introduction:
This codingchallengewillassessyourknowledgeofprogrammingandproblem solving,thisisyourchancetoshowcasewhatyou’velearnedonthemodule.
ThemarkingschemeforthistaskisonCanvas,makesureyoucheckbackonaregularbasis asyouworkthroughtheassessment.
You can implement this task in either Python or Java.
TaskOverview:
Textadventures(orinteractivefictions)areoneoftheoldestcomputergamegenres,dating backtothe60’sand70’s.Hardwarelimitationsatthetimemadedevelopinggraphicalinterfaces challenging.Instead,gameswerecontrolledthrough textualinterfaces,withcommands providedbytheplayerintheformofsimplewordsorphrases.Theseinputscanbeparsedand usedtoupdatetheinternalgamestate,whichisthenrelayedtotheplayerviatextual output. Thisinteractionformsthemain gameplayloopand ofteninvolvesplayersmaking theirway throughanin-gameworldmadeupof variouslocations,obtainingitems,solvingpuzzlesand muchmore.Thepossibilities areendless…
Togetabetterideaofwhatthesegamesareall about,it’sworthcheckingoutsomepopular gamesinthegenresuchas:‘Adventure’,‘Dreamhold’and‘Zork’.Youcanaccessseveral of thesegames onlineatthefollowinglink: http://textadventures.co.uk/ . In particular, one of the most famous original text adventure game series, Zork, can be accessed here :http://textadventures.co.uk/games/view/5zyoqrsugeopel3ffhz_vq/zork .
Yourtaskis tocreateyourowntextadventuregameinPythonorJava.
Getting Started:
Thereisnotemplatefileforthistask,youwillneedtocreateanewprogramfromscratch. Makesureyouaddyournameandstudentnumbertothetopofyoursubmission.
MinimumRequirements:
Youwilldevelopabasictext adventuregame.Youdonotneedtoincludeanypuzzlesorworry aboutwritingcompellingstories/addingwitty responses.Playersshouldbepresentedwith snippetsof narrativeandaskedtomakechoicestoprogressthegame.Thisshouldcontinue untiltheplayercompletes thegameorfails/dies.Toachieveapassinggrade,youwillneedto demonstrateknowledgeofdatastructures,functions,selectionanditeration,aswell as documentingyourcode.Refertothemark schemeonCanvas formore details.
Hereis theoverarchingbehaviourweexpectofabasictextadventuregame:
1. Presentplayers withthenameofthegameandanintroductiononlaunch.
2. Checkiftheplayerhas wonorlostthegameYoushouldeither:
a. Informtheplayerthey’velostandendthegame. b. Congratulatetheplayer andendthegame.
3. Presentedplayerswithsomenarrativetoprogressthegame.
4. Givetheplayerseveralchoicestopickfromthatallowthemto interactwiththeworld.
5. Players shouldpickachoice or enteraverb/command. Thismightallowthemtomove toanewlocation,pickupordropanitem,attackenemiesetc.
6. Checkiftheuserhasenteredavalidinput.Ifnot,continuetoprompttheuseruntilthey
enteravalidresponse,otherwise,proceedtothenextstep.
7. Parsetheplayersinput,updatetheinternalgamestateandproceedtoStep2.
Complete Requirements:
Theabove sectiondescribestheminimumrequirementsneededtoattainapassinggrade. However, toachievethemaximum possiblemark,youwillneedtoaddmorecomplexsystemsand functionality, showcasingtheknowledgeandprogramming skills youhavedevelopedoverthe courseof themodule.Belowareexamplesofmoreadvancedfunctionsthatyoumaywishto addtoyourgame,implementingthesewillattractadditionalmarks.
Ratherthangivingplayersfixedchoicestoselectfrom,allowthemtoentermore complexinputs/verbs.This shouldhelptogivetheimpression thatmorechoiceis availabletoplayers andmakethegamemorecomplex.
Severaldifficultylevels thatchangethegameinsomeform(easy,mediumandhard).
Persistentscoring systemtotrackplayers progress(reading/writingfiles).
Menu systems withvarious options (play,leaderboardsetc.)
Randomisedaspectsofthegame,forexampledifferentenemiesorweaponscould spawn,youcouldstartindifferentlocations etc.
Thegamecouldbefleshedouttoincludevariousbranchingpathsratherthanhaving playersfollowalinearroutethroughtocompletion.Forexample,thenarrativecould beaffectedbythechoices playersmake.
Structureand Documentation
Thestructureofyourcodeanddocumentationwillbeanalysedandassessed.
For Python, thiswillbedoneusingastaticanalysistool calledPylint.Thissoftwarechecksthecodein yourprogram,ensuresthatitfollowsPython or Javaconventionsandthatall functions,classesand moduleshavebeendocumented.
Python hasan official styleguidenamedPEP8,whichiswheremostPython conventions/codingstandards originatefrom.Examplechecks thatPylintcarries outtoensure thatthe PEP8codingstandardisfollowedincludethings suchas:
checkingline-code’slength
checkingif variablenamesarewell-formed (snakecase)
checkingifimportedmodules/functionsareused
checkingif variables/function parametersareused
Itis agoodideatorunthesechecks onyourcodeatregularintervals andbeforesubmitting. Thereareseveralfreewebsites thatallowyoutodothis e.g. http://pep8online.com/
Note:Marks willbedeductedforwarninganderrors detectedinyourcode.