首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
代写APSC 142、代做C/C++程序设计
项目预算:
开发周期:
发布时间:
要求地区:
APSC 142 – Introduction to Programming for Engineers II
Objective:
Students will display their knowledge of all course material to build a complete computer
program with a real-world application.
Problem:
The rules of the game are quite simple. The goal is for Pacman (the player) to collect all the dots
on a map, while avoiding the enemy ghosts (AI) that are chasing you. The game is won when all
the dots on the map have been collected. The game is lost when a ghost catches the player.
All characters in the game are bounded by that level’s map. The map contains walls (W) that
restricts the characters from passing through them, creating a maze of sorts. The dots (.) are
what need to be collected for the player to win the game. The characters can only travel
through the paths between the walls.
Below is the map that will be used in this project. The input text file will look slightly different,
as it will show you the starting position for both Pacman and the Ghosts, and will not contain
the outer walls. The primary map file is called “map.txt” and it is included in the starter code
which is available on OnQ.
APSC 142 – Introduction to Programming for Engineers II
Instructions:
Write a Pacman program in C that uses the following specifications:
• Read the map from a file called “map.txt” into an array created using malloc(). Make
sure to implement correct memory management techniques for full credit. Your
program must be able to read any map.txt file that is formatted correctly. There is an
alternative “map2.txt” file included in the starter code, for example. Any file named
map*.txt (where * can be any string) will be copied to the build directory to use upon a
CMake reload.
• The map must contain exactly one Pacman (or player) ‘P’ and two Ghosts ‘G’. Their
positions must be read from the map. If they aren’t present, or “map.txt” is not
readable, the program must return appropriate error codes. The only other characters
to be read from the map are ‘W’ for a wall, ‘.’ for a dot, or ‘ ‘ for an empty space. You
should use #defines from defines.h to refer to these characters. All such characters in a
map must have two spaces between them.
• Have the user enter an input of ‘w’, ‘a’, ‘s’, or ‘d’ that instantaneously moves the player
in that direction (up, left, down, right) if there is not a wall. You must get this input using
the getch() function included in the starter code. If there is a dot in the new location,
the player “eats” it and it is removed from the map.
• Implement 2 Ghosts (Enemies) to move around the map. If they can see the player
(there are no wall tiles between them), have the ghost move toward the player.
o The ghosts are allowed to pass through each other.
APSC 142 – Introduction to Programming for Engineers II
o The ghosts should always move when the player does.
• You must implement some specific functions using the given prototypes and
descriptions (these are listed below).
• The updated map must be printed to the console after every move. Unlike the map.txt
file, which has two spaces between each symbol, you must print the map with one
space between each symbol.
• You must write unit tests for your code. The tests must execute at least 85% of the lines
of code included in the required functions.
• You must follow any other requirements written in the starter code, for example, using
the provided global variables for storing map data (and no other globals).
• Use only the techniques and features taught in the course. If you use advanced or
unexpected features, we may assume your code has been copied.
• When the win condition has been met, the following message must be printed:
o Congratulations! You win!
• When the loss condition has been met, the following message must be printed:
o Sorry, you lose.
Comments are mandatory for this project. Add comments as necessary for important parts of
your code, such as function calls & definitions, conditions, and calculations to explain what the
program is doing.
Global Variables
Only the already specified global variables in the starter files are allowed.
The included globals will allow functions to access some commonly used variables without
being passed as arguments. In practice, global variables should be used sparingly, so you are
required to use only local variables for any other data.
Getting Started with the Starter Files
To get started, download the starter files in the zip file and unzip them into the directory you
want to work out of. Then, in CLion, choose New Project in the project menu and make the
following choices:
• In the left pane, choose C Executable.
• In the right pane, use the file picker to set the location to the directory where you
unzipped the starter files and leave the Language standard set to C11.
CLion will then pop up a modal dialogue that says Directory Is Not Empty and ask what
APSC 142 – Introduction to Programming for Engineers II
you want to do. Choose Create from Existing Sources. Then delete the main.c file from the
project, as this will not be used and can create some confusion.
Mandatory Functions:
You must implement the following functions using the provided prototypes:
• int check_win(void);
• int check_loss(int player_y, int player_x, int ghosts_y[NUM_GHOSTS], int
ghosts_x[NUM_GHOSTS]);
• char sees_player(int player_y, int player_x, int ghost_y, int ghost_x);
• char * load_map(char * filename, int * map_height, int *map_width);
• int is_wall(int y, int x);
• int move_player(int * player_y, int * player_x, char direction);
• int move_ghost(int * ghost_y, int * ghost_x, char direction);
• void print_map(void);
For each function, a detailed description of its expected behavior is provided in the comments
in its respective header file: actor.h, game.h, and map.h. See those files and the main source
file, apsc142project.c for details.
Other Important Details:
• Map details will be held in two different global maps: dot_map to hold where all the
dots are and map that contains everything printed to the screen. Whenever you need to
replace a dot in map (after a ghost moves over it), you will copy the contents from
dot_map to map. Using the maps in this way is mandatory. The auto grader will not
work if this convention is not followed.
o Note: It is a good idea to only rely on the map for tracking dots and walls. You
will track of the position of the player and the two ghosts independently.
• The maps must be stored as 1D arrays. If you use a 2D array, you will not receive full
marks. To use a 1D array (that is easy to allocate using malloc) like a 2D array, access
elements using the index [(y * width) + x].
• To check if the win condition has been met, count the number of dots still in dot_map.
This avoids the need to worry about if a ghost is covering a dot, since ghosts should not
appear in dot_map.
• You can get a random integer between 0-3 with rand() % 4.
• The getch() function is available by including “colours.h”. Do not include
yourself, as this will prevent your code from running on Gradescope.
APSC 142 – Introduction to Programming for Engineers II
• A good suggestion is to write tests before you implement your functions. This is called
Test-Driven Development and it is a way to make sure your code does what you think it
should, while ensuring good test coverage. Tests are required to get full marks in the
final labs of this course.
Getting Terminal Emulation Working in CLion
When you first load the
project starter code, you will
want to modify the run/debug
configuration for the project
executable so that it emulates
a terminal. This will cause the
getch() function to behave as
expected. To do this follow
these steps (might vary
slightly depending on your
platform and CLion version):
Find the run/debug configuration dropdown to the left of the build/run/debug buttons in the
top right corner of CLion. Click on “Edit Configurations…” at the bottom of that menu to bring
up a modal dialogue. Select project under CMake Application on the left panel, then check the
box next to Emulate terminal in the output console.
APSC 142 – Introduction to Programming for Engineers II
In-Lab Work
The final 4 lab sessions (weeks 9, 10, 11, 12) of the term will have deliverables for this project.
The labs are designed so that you need to accomplish the first one or two tasks before you can
move on to the next lab but it is “possible” to get by without question 3. If you do not complete
a lab: it is highly recommended you finish all tasks before the next lab session. The lab tasks
alone will not represent a fully completed project but do represent a passing grade. Any tasks
that require you to modify functions have that function prototype written in bold text. The
tasks will be released on a weekly basis but will follow what is given in the stater code. The
general outline is:
1. Week 09: Print the map.
2. Week 10: Make the player move.
3. Week 11: Make the ghosts move.
4. Week 12: read a map from a file.
Submission Instructions:
Create your program using CLion, basing it on the provided starter code. Do not include any
personal information (student number, name, etc.) in your submission. You will need to submit
your code in a zip file containing all the .c .h .cpp and .txt files in your project. You must include
all such files that appeared in the starter code to get full credit, even if you did not modify them
from the starter code.
While developing your solution, you should submit your code to Gradescope, which will provide
some automated test feedback, although your project will also be marked by a human. You can
(and should) set up your group when you submit to Gradescope so that both members can see
the feedback.
Refer to the project rubric in OnQ for a detailed breakdown of the grading criteria. Your
submission must adhere to the project rules as outlined in the submission policy document for
this course, which can also be found on OnQ. There is zero tolerance for plagiarism in this
course. This auto grading software will automatically flag potential cases of plagiarism, which
will be reviewed by the instructors.
Marking Rubric Summary
The official marking rubric can be found on OnQ, but it is summarized below.
The project is marked out of 36 with each lab being worth 4 marks and the other 20 marks
distributed as follows:
APSC 142 – Introduction to Programming for Engineers II
• [4] Required function implementation
◦ This tests that the required functions conform to their description in the starter files.
This mark is based almost entirely on automated tests in Gradescope.
• [4] Test coverage of required functions
◦ This checks the percentage of lines of code in the required functions that are
executed by your unit tests and is calculated almost entirely in Gradescope.
• [4] Code style and comments
◦ This checks that your code is well organized and documented properly, with good
variable names. This is marked by a human.
• [4] Game functionality (calculated mostly in GradeScope)
▪ Winning and losing occur immediately when conditions are met.
▪ Valid maps are loaded correctly and displayed to the user.
▪ Ghosts chase player when they should.
▪ Dots disappear when they should and not when they shouldn't.
▪ Player and ghosts move and respect walls.
▪ Proper error codes are returned when maps are invalid.
• [4] Secure coding practices
◦ This checks that your program follows secure best practices and does not contain
undefined behavior. This is calculated from a combination of GradeScope and
manual checks.
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写tc2343、代做python设计程...
2025-04-15
6412ele代写、代做c/c++,pyth...
2025-04-15
fit5221代写、代做python语言编...
2025-04-15
代写assessment 3 – “annota...
2025-04-15
代写 comp 310、代做 java/pyt...
2025-04-14
代做 program、代写 java 语言...
2025-04-14
program 代做、代写 c++/pytho...
2025-04-14
代写review questions – ad/a...
2025-04-14
代写eng5009 advanced control...
2025-04-14
代做ent204tc corporate entre...
2025-04-14
代写assignment st3074 ay2024...
2025-04-14
代做cs3243 introduction to a...
2025-04-14
代做empirical finance (bu.23...
2025-04-14
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!