加勒比久久综合,国产精品伦一区二区,66精品视频在线观看,一区二区电影

合肥生活安徽新聞合肥交通合肥房產生活服務合肥教育合肥招聘合肥旅游文化藝術合肥美食合肥地圖合肥社保合肥醫院企業服務合肥法律

代寫ENGR1010J、代做C/C++設計編程
代寫ENGR1010J、代做C/C++設計編程

時間:2024-12-11  來源:合肥網hfw.cc  作者:hfw.cc 我要糾錯



ENGR1010J FA2024 Lab6: Pac-Man
Due date: 23:59, December 9, 2024
Background
Pac-Man is a classic video game released in 1980. In this lab, we just need to create a basic gaming
interfac e so that we humans can play with it.
This is a screenshot from a Pac-Man game. A typical Pac-Man world contains a cute Pacman, walls,
small foods, big energy capsules, and lovely ghosts.
To make our lives easier, our version of "Pac-Man" does not feature such fancy graphics. Instead, it is
composed of all ASCII characters. Pacman is represented by a similar-looking  C , walls by  # , foods
by  . , capsules by  o , and ghosts by  @ . (The provided templates print boundaries, so you do not
need to consider them.) The picture below shows the game interface in the console.We have provided compiled executables for Windows, MacOS, and Linux. We recommend you run
the executable and play the game to get a basic idea of what you should do. Also, when you have
any doubt about whatever part you write, if your behavior matches our example program, it is
(almost) sure to say you are safe.
On MacOS or Linux, in order to run the provided executable, you may need to first run the command
 chmod +x Pacman_MacOS_arm64/x86  or  chmod +x Pacman_Linux  under the path of the text file in your
terminal. Contact TAs if you have any problems.
Unlike in the real-time video game Pac-Man, we control our Pacman frame by frame. The game will
pause every frame and wait for your input. You can type " w/a/s/d " into the game to move Pacman,
or " i " for it to stand still. Confirm your input by “Enter”, and the game will show you the next frame.
PartA: Make a Game From Scratch
Files
We have provided you with code templates, which contains  lab6.h ,  io.cpp ,  game.cpp ,  main.cpp .
The contents of each file are listed below:
File Content
lab6.h All the structs and variables as well as the function prototypes.
io.cpp Functions dealing with user inputs and output the game interface in the console.
game.cpp To realize all the functions given in lab6.h.
main.cpp The main function.
In this lab, what you need to do is to fill up the functions in game.cpp according to the comments and
instructions. Then you can run the main.cpp to test your codes with code runner. Use the command
line to compile  io.cpp ,  main.cpp ,  game.cpp  together:
 g++ -std=c++1z game.cpp main.cpp -o lab6 -I -lm . If you have any questions regarding compile
issues, feel free to ask!
However, if you think the functions in  game.cpp  are not enough, you are allowed to write your
own functions in  game.cpp , and do not forget to declare it in  lab6.h .
Variables and Functions
The game operates by a  struct game  structure. We have already specified some components of it:typedef struct game {
//Part A
 char** grid; // a 2-dimensional array of characters to display the game;
 int rows; // number of rows of the grid;
 int columns; // number of columns of the grid;
 int foodCount; // number of remaining food in the game;
 int score; // current score;
 GameState state; // the state of the game, one of losing, onGoing, or winning.
} Game;
Feel free to add more components to this structure if you would like to.
Apart from the structure, there are many functions you need to write for this game to operate. When
implementing provided function prototypes in the templates, you should follow the instructions below,
or see the comments. You MUST NOT modify the function names, or add/remove parameters. You
can also add more functions if you like. We will not check any function that are not provided.
A game of given rows and columns is created by calling the function
 Game* NewGame(int rows, int columns) . In this function, You should:
dynamically allocate space for a Game pointer
initialize all member variables of your Game structure. (For example,  foodCount  and  score 
should be initialized to 0.)
create the member grid by dynamically allocating a 2-dimensional array of given size.
Boundary is not included in either rows or columns, and the cell at top-left corner is at row 0 and
column 0.
When the game ends, the function  void EndGame(Game* game)  is automatically called. In this function,
you should:
free any memory you dynamically allocated, such as grid.
free the parameter game, as it is also dynamically created.
Walls, foods and Pacman are added to the game by functions  AddWall ,  AddFood , and  AddPacman . In
these functions you should:modify the grid in your  Game  structure to make sure whatever item you add displays correctly.
make sure all of these game components can only be added to an empty cell.
make sure Pacman cannot be added to the game if there is already a Pacman.
Finally, you can write the function  void MovePacman(Game* game, Direction direction)  to control your
Pacman.  Direction  is an enum of  {up, down, left, right, idle}  . The rule to move your Pacman
is as follows:
On  idle , Pacman will stay still.
If Pacman would move to an empty cell, Pacman will do so successfully;
If Pacman would move to a food cell, Pacman will move to it and eat the food. Your score will
increase by  FOOD_SCORE = 10 . If Pacman eats the last food, you win the game. You should mark
the state of this game as winning.
If Pacman would bump into a wall or a boundary, Pacman will stay still.
In any of the cases above, your score should decrease by 1, for one turn you have played.
You can have a better understanding of the whole process by reading the sample  main()  function in
 main.cpp  and function  void PlayGame(Game* game)  in  io.cpp .
Time to play!
You can initialize your custom game in your  main()  function by calling  NewGame . After that, you can
add walls and foods to any specific location by  AddWall  and  AddFood . Don’t forget to add a Pacman
by AddPacman to the game.
When your game is prepared, you can call the provided  PlayGame  function. When you win or lose,
 PlayGame  will terminate by calling  EndGame .
If your game runs... Congratulations! You now have a "complete" Pacman game. You can submit it to
JOJ for Part A, and the first three testcases are for Part A, so don't worry if you cannot pass the last
cases now. However, the game seems a little boring, let’s go to Part B...
Part B: Here come the ghosts!
Your game is missing a part of the greatest fun - the ghosts. In this part, you will add ghosts and
energy capsules to your game so that it will become more playable.
We do not force any restrictions on how you should store your data for ghosts and capsules. Do you
think you need to write a structure, especially for ghosts? If so, what do you need to store in it? Your
design can be in any way you like (but still try not to use global variables), as long as it meets the
requirements below:Requirements for ghosts:
There are at most  MAX GHOSTS = 30  ghosts.
Ghosts are added to the game by the function
 bool AddGhost(Game* game, int r, int c, Direction direction) .
This function is slightly different, as ghosts can be added on a cell with food or a capsule.
Ghosts cover foods and capsules in display, so their cells (originally  .  or  o ) will be
displayed in  @ . However, those food or capsules must still exist, and should be displayed
again when ghosts leave their cells.
 Direction  defines how a ghost moves. Ghosts move either in a horizontal line or a vertical
line. The parameter  direction  in this function is the ghost’s initial direction.
Ghosts are moved by the function  void MoveGhosts(Game* game) .
This function will move all ghosts in the game by one step to their own directions.
Ghosts should be moved in the order they were added.
If a ghost would move onto a cell with food or a capsule, it will cover the food or capsule in
display, so that cell (originally  .  or  o ) will be displayed in  @ . However, that food or capsule
must still exist, and should be displayed again when this ghost leaves that cell.
If a ghost would bump into a wall, another ghost, or a boundary, its direction will reverse,
and it will try to move in the new direction immediately this turn. If then it would bump into
another wall/ghost/boundary, it will stop and won’t move for this turn, with its direction
reversed.
Now it is possible to lose the game. By rules, Pacman always moves first. There are three situations
that need to be specified:
If Pacman directly bumps into a ghost, Pacman will move to that cell, and get killed. You should
mark the game state as losing.
If a food or a capsule is below that ghost, Pacman cannot eat it.
If Pacman moves to a cell that a ghost also attempts to move to, Pacman will perform a
successful move, and the ghost then moves onto Pacman’s cell. You will also lose the game.
Requirements for capsules:
Capsules are large foods that give Pacman superpower. Therefore, capsules are counted as the
number of foods in the game. Pacman must eat all food and capsules to win.
Capsules are added by the function  bool AddCapsule(Game* game, int r, int c) . Like food, a
capsule cannot be added to a cell with a wall, a Pacman, or a ghost. However, a capsule can be
added to a cell with a food, resulting in that food being upgraded to a capsule.
When Pacman eats a capsule, your score will increase by  CAPSULE SCORE = 50 , and Pacman will
gain superpower for its next  CAPSULE DURATION = 10  moves. Its superpower is that:
All ghosts will be scared, and their display change from  @  to  X . When Pacman’s
superpower expires, they change back to their cute evil faces  @ .Scared ghosts are slowed down by 50%, which is shown by that they cannot move every
other turn.(We cannot move ghosts by half a cell, after all) They will be able to move on the
same turn when Pacman eats a capsule, but cannot move the next turn. This goes on until
Pacman’s superpower expires.
When with superpower, Pacman can eat ghosts! When Pacman moves onto a grid with a
scared ghost, it eats the ghost, earning a score of  GHOST SCORE = 200 . If there is a food or a
capsule below that ghost, Pacman eats it as well. That ghost will not respawn and can be
removed from the game. The same goes for the case when a scared ghost bumps into
Pacman.
Pacman’s superpower activates immediately when it eats a capsule, and counts down right after
Pacman’s turn, starting from its next turn. For example, if Pacman and a scared ghost attempt to
move onto the same grid on Pacman’s 10th turn of superpower, Pacman will move first, but its
superpower will immediately expire, and that ghost, not scared anymore, can kill Pacman. In
other words, Pacman’s superpower ends after 10 turns at the same moment of eating a capsule.
If Pacman eats another capsule while it has superpower, the duration of superpower will be
refreshed to 10 turns, rather than stack. In this case, it is possible that a scared ghost has
already moved on the turn(the new 9th turn) right before the turn when Pacman’s superpower
expires(10th). That ghost can still move on its next turn(10th), because it will not be a scared
ghost then.
Finally, you can add ghosts and capsules to your game in your main function, and enjoy the finished
game of Pacman. The submission is the same as how you did for part A. Good luck and have fun!
Rubric
Tasks
Part A: 30 pts
Part B: ** pts
Oral Explanation: 30 pts
Total: 150 pts
Deduction
Late submission on Canvas: -20 pts per day. JOJ will be closed on the day of the lab, so no late
submission will be accepted on JOJ.
Global variables: Using global variables in such a big project could be dangerous and you will
lose 10 points for each global variable.Submission
You need to compress your  game.cpp  and  lab6.h  file into a single zip file and submit it to JOJ.

請加QQ:99515681  郵箱:99515681@qq.com   WX:codinghelp




 

掃一掃在手機打開當前頁
  • 上一篇:代做CS-107、java程序語言代寫
  • 下一篇:CE235編程代寫、代做python程序設計
  • 無相關信息
    合肥生活資訊

    合肥圖文信息
    2025年10月份更新拼多多改銷助手小象助手多多出評軟件
    2025年10月份更新拼多多改銷助手小象助手多
    有限元分析 CAE仿真分析服務-企業/產品研發/客戶要求/設計優化
    有限元分析 CAE仿真分析服務-企業/產品研發
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    急尋熱仿真分析?代做熱仿真服務+熱設計優化
    出評 開團工具
    出評 開團工具
    挖掘機濾芯提升發動機性能
    挖掘機濾芯提升發動機性能
    海信羅馬假日洗衣機亮相AWE  復古美學與現代科技完美結合
    海信羅馬假日洗衣機亮相AWE 復古美學與現代
    合肥機場巴士4號線
    合肥機場巴士4號線
    合肥機場巴士3號線
    合肥機場巴士3號線
  • 短信驗證碼 目錄網 排行網

    關于我們 | 打賞支持 | 廣告服務 | 聯系我們 | 網站地圖 | 免責聲明 | 幫助中心 | 友情鏈接 |

    Copyright © 2025 hfw.cc Inc. All Rights Reserved. 合肥網 版權所有
    ICP備06013414號-3 公安備 42010502001045

    欧美福利在线播放| 国产免费久久| 99xxxx成人网| 久久久久久久久成人| 四虎精品一区二区免费| 99成人在线| 国产精品网在线观看| 国产精品www.| 欧美片第1页| 国产精品女主播一区二区三区| 香蕉大人久久国产成人av| 欧美成人毛片| 色综合桃花网| 中文一区二区| 99热精品久久| 精品午夜av| 成人在线啊v| 一区二区国产精品| 国产h片在线观看| 黄色亚洲大片免费在线观看| 精品国产一区二区三区av片| 久久不见久久见免费视频7| 久久国产麻豆精品| 一本大道色婷婷在线| 久久国产精品亚洲77777| 久久一区二区中文字幕| 福利片在线一区二区| 日韩成人免费在线| 高清精品久久| 日本中文在线一区| 国产精品蜜月aⅴ在线| 日韩伦理福利| 蜜桃av一区二区在线观看| 在线精品小视频| 激情自拍一区| 久久综合国产| 久久天堂成人| 精品久久ai电影| caoporn成人| 精品999日本久久久影院| 久久超碰99| 国产毛片一区二区三区| 亚洲精品日韩久久| 亚洲日本黄色| 麻豆精品国产传媒mv男同| 色8久久久久| 国产欧美日韩综合一区在线播放 | 久久精品一区二区三区中文字幕| av资源亚洲| 成人片免费看| 欧美中文字幕精在线不卡| 欲香欲色天天天综合和网| 欧美疯狂party性派对| 蜜臀av性久久久久蜜臀aⅴ流畅| 午夜亚洲伦理| 久久不射网站| 美女91在线看| 日韩欧美精品综合| 欧美一区二区三区婷婷| 国产福利91精品一区二区| 日韩成人一区| 亚洲色图网站| 亚洲福利天堂| 一区二区三区在线资源| 99re91这里只有精品| 女同一区二区三区| 激情婷婷综合| 在线视频免费在线观看一区二区| 99亚洲视频| 免费在线看成人av| 日韩中文字幕高清在线观看| 成人国产精选| 青青青爽久久午夜综合久久午夜 | 羞羞视频在线观看欧美 | 黑人久久a级毛片免费观看| 91午夜精品| 欧美一区二区麻豆红桃视频| 黄色亚洲大片免费在线观看| 美女国产一区| 91看片一区| 在线免费高清一区二区三区| 国语精品视频| 欧美日韩麻豆| 99riav国产精品| 五月天国产在线| 免费亚洲网站| 欧美人与拘性视交免费看| 亚洲2区在线| 波多野结衣的一区二区三区| 免费成人av在线| 精品久久久网| 日韩高清一级| 999久久久精品国产| 视频精品一区二区| 成人在线视频免费| 欧美成人精品一级| 久久久久.com| 久久亚洲风情| 日韩综合久久| 日产国产高清一区二区三区| 久久精品官网| 免费看黄色91| 日本免费在线视频不卡一不卡二| 精品伊人久久| 亚洲黄网站黄| 国产精品第一| 久久久久亚洲精品中文字幕| 午夜久久黄色| 国产福利亚洲| 日韩一区二区三区精品视频第3页 日韩一区二区三区精品 | 青青久久av| 成人在线丰满少妇av| 欧美亚洲视频| 精品无人区一区二区| 免费xxxx性欧美18vr| 欧美日韩 国产精品| 久久97久久97精品免视看秋霞| 亚洲欧美日韩综合国产aⅴ| 国产日韩一区二区三区在线| 蜜桃精品视频| 免费高清在线视频一区·| 久久精品二区亚洲w码| 欧美日韩天堂| 国产精品久久久久久影院8一贰佰 国产精品久久久久久麻豆一区软件 | 欧美13videosex性极品| 国产在线观看91一区二区三区| 日日天天久久| 青青青免费在线视频| 国产精品日本一区二区不卡视频 | 最新国产精品久久久| 激情婷婷久久| 日韩三级一区| 欧美三级自拍| 成人不卡视频| 老牛国内精品亚洲成av人片| 神马午夜在线视频| 日韩视频一区二区三区四区| 男人的j进女人的j一区| 国产成人久久| 亚洲免费综合| 国产精品2区| 99riav1国产精品视频| 亚洲精品字幕| 99在线|亚洲一区二区| 亚洲国产片色| 日韩亚洲国产精品| 国产精品嫩草影院在线看| 一本色道精品久久一区二区三区| 亚洲理论在线| 亚洲国产日韩欧美在线| 美女一区二区久久| 欧美老女人另类| 欧美日韩亚洲一区三区| 午夜国产精品视频| 亚洲日韩中文字幕一区| 欧美中文字幕| 日韩电影在线一区二区三区| 97精品视频在线看| 国产精品对白| 一区二区三区国产盗摄| 一本久久青青| 亚洲日韩成人| 美女尤物久久精品| 婷婷精品在线观看| 亚洲天堂免费电影| 欧美一区二区三区高清视频| 在线看片日韩| 人人超碰91尤物精品国产| 色妞ww精品视频7777| 91亚洲视频| 羞羞答答成人影院www| 成人黄色91| 日韩欧美综合| 91久久电影| 欧美激情在线免费| 日韩欧美高清| 女人av一区| 亚洲尤物av| yy6080久久伦理一区二区| 九一精品国产| 日韩影视在线观看| 日本国产一区| 亚洲欧美成人综合| 超碰一区二区三区| 亚洲久久一区二区| 黄视频网站在线观看| 亚洲91视频| 国产欧美日韩在线观看视频| 精品123区| 国产农村妇女精品一区二区| 综合视频一区| 日本va欧美va精品| 日韩国产欧美| 日韩视频一区| 精品在线网站观看| 欧美男gay| 欧美在线二区| 视频一区二区不卡| 伊人久久大香线蕉av不卡| 日韩影视高清在线观看|