欢迎来到天天文库
浏览记录
ID:38471986
大小:2.02 MB
页数:11页
时间:2019-06-13
《极限编程大赛试题AE》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Solvingthispuzzlewillimproveyourrankto324RobotTennisInRobotWorldagrandchampionshipontennisisabouttotakeplace.AllthebestrobotictennisplayershavealreadystartedpracticeforthisgreateventandtheyarereadytogivetheirbestfortheRoboticCup!Unfortunately,duetothebadweatherbothth
2、etennisfieldwherethetournamentwasabouttotakeplacewasruinedandtherefereeofthegamegotill.Canyoudevelopaprogramthatcouldsimulatethetennisfieldandthecoachinordertohostthetournament?TaskYourtaskistodevelopaprogramthatcanefficientlysimulateatennismatchbetweentworobotictenn
3、isplayers.Thesimulationshouldcomplywiththefollowingrulesofthegame:(Note:pleasealsorefertoFig.1forabetterunderstandingofthenotationsandtherules)1.Thetenniscourtwillbea2dimensionalspacecomprisedofnrowsandmcolumns.2.Ateverymatch,onlytworobots(Robot1andRobot2hereafter)ca
4、nparticipate.3.Robot1canbepositionedatanycolumn(eventherightmostortheleftmostcolumn)butalwaysatthefirstrowofthetenniscourtwhereasRobot2canbepositionedatanycolumnbutalwaysatthelastrowofthetenniscourt.1.Ontherightmostandtheleftmostsideofthetenniscourtthereexistbouncing
5、wallswhichmaychangethedirectionoftheballwhenitcollideswiththem.2.Moreover,obstaclesmayexistwithinthetennisfield.Obstaclescannotbepositionedatthefirstandthelastrowofthetennisfield,norattheleftmostandrightmostcolumnsofthetennisfield(i.e.obstaclescannotco-existneitherwi
6、throbotsnorwithbouncingwalls).Obstaclesalwaysalterthedirectionoftheball.3.Bothrobotscanonlymovealongthehorizontalaxis(i.e.onlytotherightortotheleftoftheircurrentposition)andneverontheverticalaxis.4.Norobotisallowedtostaystill.Ateverystep,atfirsttheballmovesandtheneac
7、hrobotshouldmoves(onthehorizontalaxis)towardstheball,meaningthatiftheballispositionedatacolumniandtherobotisatcolumnj,andi,thentherobotshouldmovetotheleft,whereasitshouldmovetotherightifi>j.Incasethatboththeballandarobothappentobeinthesamecolumn(i=j),therobo
8、tshouldtrytomovetotherightbydefault.Ifthisisnotpossible(becauseitisalreadyattherightmostsideofthetennisfieldandmovingtotherightmean
此文档下载收益归作者所有