Assignment 2: Step
Monster High
Introduction
Inthisassignment,we’ll write Step code to select and execute contentunits. Our contentunits areplot
points for a soap opera world called MonsterHigh. Inthisworld,students,whoalsohappen to be
monsters, engagein conflicts and romance.
Theprovidedcode setsuptheframework for theassignment.You’llbeaddingcode to two of thefiles,
Queries.step andPlotPoints.step,as well as potentially changing the initialstate oftheworld in
Students.step to test your code.
Thiscode works by testingthestateof the world to see which plot pointsarepotentially applicableand
thenpickingoneto execute. Two entrypoints have been providedfortesting the code.The task
[Events] selects and executes sixrandomplotpoints.Thetask[ShowPlotPointMenu] showsa
menu ofalltheplotpoints availablein the currentstory state.Theusercanselect one,it executes,anda
menu ofplotpoints available in thenewstateisdisplayed.Plotpoints will be represented as tuples,soif
youhaven’tdone thereadingontuples,do thatnow.
Forexample,wemightrepresenttheplotpoint that Jaydenconfesses their love toTiana with the tuple:
[confess_lovejayden tiana]. However, this only makessense ifweknowthatJaydenhasa
crushonTiana,otherwise, why wouldtheyconfess? Andit doesn’t make senseifthetwoarealready
dating. So you need tomakesurethattheconfess_love plotpoint isonlyavailablewhenthere’san
attraction that isn’t being actedon. When this plotpoint executes, it mightbeprintedas“Jayden
confesses their love toTiana”.Additionally,when theplotpoint executes,it changes the
stateofthe world sothatTiana now knowsthatJaydenasa crushonTiana:KnowsTiana [CrushOn
JaydenTiana].Here we’re also using tuples torepresentwhat itisTianaknows.
We’reusingfluents torepresentthechanging state oftheworld asplotpoints execute.Read more
about fluentsintutorial8.
Note also that we’veprovidedyouwitha versionofMention thatunderstandsthingslikepronoun
generation and capitalization ofcharacternames. Youdon’t need todoanythingwithit,justrealizethat
it’sthere. Ifyoudon’t knowwhat Mention is,readpart6 ofthetutorialongenerating text incontext.
Getting started
Tobegin with,dragtheMonsterHigh folderintotheDocuments/Stepfolder onyour machine(theStep
folderinside your Documentsfolder). Then, open theMonsterHigh folderyoujustputinside the Step
folder inVisualStudioCode.
ReplacetheearlierversionofStepthatyoudownloadedwiththenewversionprovidedinthe
assignmentziparchive.ThisnewversionofStepfixes abugthataffects the assignment.
Finally,startStep,andtype“projectMonsterHigh”.
Optional: Making a student body
ThefileStudents.step definesthestudentbody,including what type ofmonstereachstudentis,
what clubspeoplearein,andwhohascrushes,isdating,andarefriends.Forthepurposesoftesting
your code, you may want to create yourownstudentbody with aspecificinitial state. However,you
don’t need todothisif you don’twant to.
Note that theMention codewegave you will usethey asthepronounforallcharacters bydefault. If
youprefer,youmayoptionally specifypreferred pronouns for some orallof your characters. Todo
that,justaddstatements toyour Students.step fileoftheform:
PreferredPronoun student pronoun.
Wherestudentisthestudent you’re specifying apronounfor,andpronoun is eitherhe or she. You can
specifythey, butsince that’sthedefaultanyway,there’snoparticular point indoing so. Anyoneyou
don’t specifya pronoun for willbereferredtousing they.
Part one: Queries
ThefileQueries.Step defines predicaterules toinferinterestingrelationsinthestoryworld.
Examplesinclude:
UnrequitedLove ( aiscrushing b ,butnotviceversa)and,
CheatingOn cheater cheatee ( cheaterisdating cheatee and isalsodatingsomeoneelse).
Writepredicaterulesforeachofthepredicates specifiedinQueries.Step.
Part two: Plot Points
Where:
• eventType is thekindof event(e.g.confess_love,star_crossed_lovers,etc.)
• other-information istheotherinformationthatappearsinthatkindofevent:definitely the
characters participating in it,butforsome ofthem,there arethings like the monstertypes or
clubsthestudentsbelongto
• condition istheinformationtodetermine whetherthisplotpoint isallowedinthecurrentstate
ofthestoryworld.
Here’sanexample. Forthebreakupplotpoint,itonlymakes sense for it to happen ifthe charactersare
alreadydatingandhave hadafight. Sotheruleforthatwould look like:
Willgenerate:
IlikeJayden. They read books.
IfJayden’spreferredpronounisthey,but:
IlikeJayden.He reads books.
IfJayden’spreferredpronounishe.
Themagic[s] taskonlyworksforregularverbs. Ifyouwant tohandle adifferentverb, thengrabthe
codeforIs fromMention.step andjustchangeit for your verb.
Part four: Invent some more plot points
Now write PlotPoint andExecutePlotPoint methodsfortwomore kindsofplotpoints. Theycan
beanythingof yourchoosing, although they need todependonthestory world. Feelfreeto addnew
informationto thestoryworldifyoulike.
Some ideas:
• Two characters have a heart-to-heart discussion whileat their club. This would obviously only
make sense whenthey’reinthesameclub.
• Two characters becomefriends afterafight. For that,there’dneed tobea reasonforthemto
have thefight. Andtheyprobablyshouldn’t bedating,since peoplewhoaredating should
probablyalreadybefriends. Maybe theybecomefriendsbecausetheyhave a shared friend.
• Awerewolfcharacterdoessomething onthefullmoon
• Avampirecharacterbites a humancharacter
Turning it in
Save allyour files, reload(control-R)tomake sure everythingreally does load. Assuming everything
seems okay, make azipfileofyour MonsterHigh directory and uploadit tocanvas.
版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。