MTRX3760-C++、InheritanceandPolymorphism

PolymorphicDiceRace

TheDiceRaceprogramfromLab1featuredonekindofplayerthatalwaysusedthesame,randomstrategy.Inthisexampleyouwillapplyyourknowledgeofinheritanceandpolymorphismtoredesignthatprogram.YoumaystartfromthecodeyouproducedinLab1,orredotheprogramfromscratch.

Makethefollowingchangestotheprogram:

●Usetwodice,notone.Bothdicearerolledandtheirsumisusedtodecidehowfartoadvancethemarker,ratherthanusingasingledie.

●Increasetheboardlengthto64.

●Whenaplayerchoosestodelaytheiropponent,theyarenowdelayedby12moves,not3.

●Implementthreedifferentkindsofplayer:

a.Random:TherandomstrategyfromLab1,

b.Charge:Theplayeralwayschoosestoroll,and

c.Yours:Astrategyofyourdevisingthatusesinformationaboutwherethemarkersaretodecidewhethertoadvanceordelay.

●Writeasingleprogramthatevaluateseachofstrategy(b)andstrategy(c),reportinghowlikelyeachistowinwhencompetingagainst(a),expressedasaprobabilityinpercent.e.g.arandomplayerhasa50%chanceofbeatinganotherrandomplayer.

●Refactorallcodebyapplyingcodingpracticesandconceptscoveredinthefirstfourlectures,includingcodingstyleanduseofconstructors/destructors.Youdonotneedtosplittheprogramintomultiplefiles.

[20Marks]Functionality:Inyourreportshowthepartofyourprogramoutputthatreportsoneachstrategy’slikelihoodofwinning.Describeyourstrategy(c)inbullet-pointforminthereport.Thisandthecodeinyourattached.zipfilewillbeassessedforcorrectfunctionality.Therearenomarksassociatedwiththesuccessrateofyourproposedstrategy.

[30Marks]CodeQuality:Yourcodewillbeassessedbasedonstyleandcodingbestpracticesastaughtinlecture.

[50Marks]Design:InyourreportprovideacompleteUMLclassdiagramforyourdesign,includingsignificantmembervariablesandfunctions.Thisdiagramandyourcodewillbeassessedbasedonappropriateuseofthedesignprinciplestaughtinlecture.

你可能感兴趣的:(python,eclipse,线性代数,云计算,c++,c语言,c#)