CSC 256代写、C++设计编程代做
CSC 256-04 Final Project Part 2 (50 Points)
An ancient robot game
For this project, you are given a program that implements a game where a human user
tries to escape from four robots. The user and four robots are on an x-y grid. On every
step, you enter a move for the human. The robots will attempt to get closer to the human.
When a robot has the same x-y coordinates as the human, the game is over. You will
translate this program faithfully, following all function call guidelines and MIPS register
use conventions.
Two arrays x[4] and y[4] keep track of the x- and y-coordinates of four robots. The
positions of the human and the four robots are initialized in the program. On each step,
the user enters a move; the positions of the human and the robots are updated. This
continues until the human dies. This figure gives an idea of the game; we’ll work with a
text-only version, sorry.
In the main loop, the user is prompted to enter a move. The position of the user is
updated. Then the program calls a function moveRobots() to update the position of
the robots as they try to catch the human. The new positions of the human and the robots
are then displayed.
The function moveRobots() has prototype
int moveRobots(int *arg0, int *arg1, int arg2, int arg3)
arg0 is the base address of array that contains the x-coordinates of the four robots, arg1 is
the base address of array that contains the y-coordinates of the four robots, arg2 is the
x-coordinate of the human, arg3 is the y-coordinate of the human.
moveRobots()updates the positions of the four robots, and returns a 1 if the human is
alive, and a 0 if the human is dead (i.e., the human has the same coordinates as a robot).
Each coordinate of a robot is updated by calling the function getNew(), which returns
the new coordinate based on the current coordinate of the robot and the current
coordinate of the human.
When you translate moveRobots() to MIPS assembly language, arg0 through arg3
are in $a0 through $a3; the return value is in $v0.
The function getNew() uses simple rules to move a robot closer to the human. If the
difference in the coordinates is >=10, the robot's coordinate will move 10 units closer to
the human. If the difference in the coordinates is < 10, the robot's coordinate will
move one unit closer to the human. (See program listings.) getNew() has prototype
int getNew(int arg0, int arg1)
arg0 is the coordinate (x or y) of a robot, arg1 is the coordinate (x or y) of the human.
getNew() returns the new coordinate of the robot, based on the position of the human.
The function getNew() is already translated to MIPS assembly language, arg0 and arg1
are in $a0 and $a1 respectively, and the return value is in $v0.
A copy of the C++ program robots.cpp can be found here. The file assembly file contains
the main program and getnew(), already translated into MIPS assembly language. Your
functions will follow the main program in the same file. The template assembly file can
be found on Canvas.
Write the functions exactly as described in this handout. Do not implement the
program using other algorithms or tricks. Do not even switch the order of the arguments
in function calls; you must follow the order specified in the C++ code. The purpose of
this program is to test whether you understand nested functions. If you wish to make
changes to the algorithm, you must first check with the instructor.
Your functions should be properly commented. Each function must have its own header
block, including the prototype of the function, the locations of all arguments and return
values, descriptions of the arguments and how they are passed, and a description of what
the function does. Paste in the C++ code as inline comments for your MIPS assembly
code.
Submission: submit your code via Canvas. All your code should be in a single plain text
file(PDF only).
80% of your grade is for correctness. 20% is for clarity/documentation.
Output%
Your coordinates: 25 25
Enter move (1 for +x, -1 for -x, 2 for + y, -2 for -y):2
Your coordinates: 25 26
Robot at 10 10
Robot at 10 40
Robot at 40 10
Robot at 40 40
Enter move (1 for +x, -1 for -x, 2 for + y, -2 for -y):1
Your coordinates: 26 26
Robot at 20 20
Robot at 20 30
Robot at 30 20
Robot at 30 30
Enter move (1 for +x, -1 for -x, 2 for + y, -2 for -y):2
Your coordinates: 26 27
Robot at 21 21
Robot at 21 29
Robot at 29 21
Robot at 29 29
Enter move (1 for +x, -1 for -x, 2 for + y, -2 for -y):1
Your coordinates: 27 27
Robot at 22 22
Robot at 22 28
Robot at 28 22
Robot at 28 28
Enter move (1 for +x, -1 for -x, 2 for + y, -2 for -y):2
Your coordinates: 27 28
Robot at 23 23
Robot at 23 28
Robot at 27 23
Robot at 27 28
AAAARRRRGHHHHH... Game over
libra%
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- 威尔特(广州)流体 - MR V服务体系分析
- 电报最佳群发工具推荐,Telegram全能群发助手,TG拉群发策略
- CE-Channel: Paving the Way for Brand Expansion Abroad with Tailored International Solutions
- Ig引流软件,Instagram批量私信工具,ins引流手把手教学
- 吉因加助力科技重大专项,胃癌个性化新抗原肿瘤疫苗研究谱新章
- 科技感官奇兵,WhatsApp拉群工具
- CSC3150代写、Java/C++程序语言代做
- 星辰大陆的创新魔法 WhatsApp拉群工具是科幻魔法师业务探险的必备法宝
- 中国空间安全网:守护太空,共筑安全新篇章
- 海纳AI面试官发布智能校招一体化解决方案
- Instagram营销软件 - ins引流神器/ig接粉软件/ins打粉软件
- Line群发云控引领社交推广在商海的征途上,与客户分享喜悦
- AD9573ARUZ-RL7: Versatile Clock Management for Demanding Applications | ChipsX
- Ins引流工具全新升级,Instagram群发工具助你实现营销突破!
- ARCHE-2024第三届上海国际智慧档案展览会暨高峰论坛即将开幕
- 代做Data 102
- instagram社交爆发神器,一键群发采集,助你快速引流!
- 中囤律商信用管理有限公司:引领企业信用修复与ISO体系认证的新篇章
- 代做EECE 6083、c/c++设计程序代写
- Instagram打粉营销软件,Ins引流助手,共同助你赢得市场!
- instagram营销软件,ins群发拉群,天宇爆粉【TG:@cjhshk199937】
- 科林助听器爱耳行动进行时,以科技助力聆听守护
- 倍成就 WhatsApp拉群营销工具 为你的销售数字描绘辉煌
- 新质互融,算力共振:玻色量子发布新一代550计算量子比特相干光量子计算机
- WhatsApp群发软件,ws全球代发/ws拉群/ws接粉/ws协议号出售
- 揭秘ins快速爆粉技巧!Instagram自动群发私信吸客利器,Ins新手必备!
- 青瞳视觉2024新产品及解决方案发布盛典成功举办
- EP4SE230F35I4NAA: Pioneering Efficiency and Performance in Integrated Circuits | ChipsX
- 魔法盛宴 WhatsApp拉群工具如何在我的业务中释放科幻魔法的无穷潜能
- ADF4360-3BCP: Enabling Precision Frequency Synthesis in Wireless Communication Systems | ChipsX
推荐
- 创意驱动增长,Adobe护城河够深吗? Adobe通过其Creative Cloud订阅捆绑包具有 科技
- 苹果罕见大降价,华为的压力给到了? 1、苹果官网罕见大降价冲上热搜。原因是苹 科技
- B站更新决策机构名单:共有 29 名掌权管理者,包括陈睿、徐逸、李旎、樊欣等人 1 月 15 日消息,据界面新闻,B站上周发布内部 科技
- 升级的脉脉,正在以招聘业务铺开商业化版图 长久以来,求职信息流不对称、单向的信息传递 科技
- 全力打造中国“创业之都”名片,第十届中国创业者大会将在郑州召开 北京创业科创科技中心主办的第十届中国创业 科技
- 丰田章男称未来依然需要内燃机 已经启动电动机新项目 尽管电动车在全球范围内持续崛起,但丰田章男 科技
- 疫情期间 这个品牌实现了疯狂扩张 记得第一次喝瑞幸,还是2017年底去北京出差的 科技
- 如何经营一家好企业,需要具备什么要素特点 我们大多数人刚开始创办一家企业都遇到经营 科技
- 老杨第一次再度抓握住一瓶水,他由此产生了新的憧憬 瘫痪十四年后,老杨第一次再度抓握住一瓶水,他 科技
- 智慧驱动 共创未来| 东芝硬盘创新数据存储技术 为期三天的第五届中国(昆明)南亚社会公共安 科技