代做INT2067、Python编程设计代写
Assignment 1
INT2067 Introduction to Programming and Problem Solving
2024-2025 Semester 1
Due Date: October 30, 2024 (Wednesday)
1 Introduction
In this assignment, you need to implement a text-based game based on the riddle about
a farmer who needs to cross a river with a fox, a goose, and a sack of corn.
2 Riddle
A farmer with a fox, a goose, and a sack of corn needs to cross a river. The farmer has a
rowboat, but there is room for only the farmer and one of her three items.
Unfortunately, both the fox and the goose are hungry. The fox cannot be left alone with
the goose, or the fox will eat the goose. Likewise, the goose cannot be left alone with
the sack of corn, or the goose will eat the corn. How does the farmer get everything
across the river?
3 Game
In your text-based game, the farmer can move at most one item to the other shore each
time. You should ask the user to enter a command to determine what item the farmer
wants to take at each turn. The game ends when the user quits the game or when the
user has succeeded or failed.
4 Basic Design
You may follow the following basic flow in your program:
Show item locations.
Repeat:
1. Ask for the next command.
2. Update item locations if necessary.
3. Show item locations.
4. Exit the loop if the game has succeeded or failed.
You may need to add other steps and/or flows to fulfill all the requirements.
5 Requirements (70%)
Your program should do the following:
[5%] Print the goal of the game at the start.
[10%] Ask the user to enter a command at each turn and continue until the user
requests to quit or the goal has succeeded or failed.
[10%] Show the location of the boat and the three items (fox, goose, corn) clearly
at the start of the game and after each turn. You may follow the output in the
sample session.
Accept the following five one-character strings as valid commands: f, g, c, m or
q. After receiving a valid command, the game should:
o f, g or c: move the fox, goose, or corn, if available, to the opposite shore
along with the boat. [10%]
o m: move the boat to the opposite shore without any item. [5%]
o q: quit the game. [5%]
[10%] Check whether the requested item is on the same shore as the boat when
the game receives the command f, g or c. If not, it should prompt an error and
allow the user to enter a command again.
[10%] Check whether the game has succeeded or failed after each turn. The
game has succeeded if all items have been moved to the far shore. The game
has failed if the fox has eaten the goose, or the goose has eaten the corn. When
the game has succeeded, it should congratulate the user. When the game has
failed, it should tell the user why.
[5%] Show an error if the user has entered an unrecognized command character
(i.e. a string other than ‘f’, ‘g’, ‘c’, ‘m’ or ‘q’).
6 Program Design and User Interface (30%)
[10%] You should break down your program into functions with reasonable
length.
[10%] You should use functions and/or lists to reduce redundancy.
[10%] The output should be neat, and the required information should be shown
clearly. The text in the output should be correct and contain no spelling
mistakes.
7 Submission Requirements
Your Python file should be named as assignment1.py. Submit only the Python
file assignment1.py through Moodle. Failure to submit the file properly will
result in a penalty of 5 to 20 marks.
See Moodle for the exact time of the deadline for submission. Late submission is
usually not accepted. You should submit earlier to avoid possibly high tra ic
around the deadline.
8 Hints
Please check the discussions forum on Moodle regularly for any hints.
9 Plagiarism Policy
The assignment should be done only by yourself. Every line of code should be written by
you. Discussions on the assignment should be kept at a high-level only. You are
suggested to refer your classmates to the relevant notes or lab exercises if you want to
help them.
If cheating is found, both the copier and originator will get zero mark for the
assignment.
Repeat o enders may result in a deduction of the course grade.
If you have discussed the assignment with anyone, you should provide an
acknowledgment at the end of your program file. Give the names of all classmates that
you have discussed with. For example, your acknowledgement may look like this at the
end of your program file:
# Acknowledgement: I have discussed it with Thomas, Gordon, and Emily.
10 Sample Session 1
Welcome.
You must bring the fox, the goose, and the corn across the
river.
------------------------
Boat
------------------------
Fox Goose Corn
You are now at the near shore, what do you want to take? g 
Goose
------------------------
Boat
------------------------
Fox Corn
You are now at the far shore, what do you want to take? m 
Goose
------------------------
Boat
------------------------
Fox Corn
You are now at the near shore, what do you want to take? f 
Fox Goose
------------------------
Boat
------------------------
Corn
You are now at the far shore, what do you want to take? g 
Fox
------------------------
Boat
------------------------
Goose Corn
You are now at the near shore, what do you want to take? c 
Fox Corn
------------------------
Boat
------------------------
Goose
You are now at the far shore, what do you want to take? m 
Fox Corn
------------------------
Boat
------------------------
Goose
You are now at the near shore, what do you want to take? g 
Fox Goose Corn
------------------------
Boat
------------------------
Congratulations!
You have brought all the items across the river.
11 Sample Session 2
Welcome.
You must bring the fox, the goose, and the corn across the
river.
------------------------
Boat
------------------------
Fox Goose Corn
You are now at the near shore, what do you want to take?
goose
You have entered an invalid command.
------------------------
Boat
------------------------
Fox Goose Corn
You are now at the near shore, what do you want to take? f 
Fox
------------------------
Boat
------------------------
Goose Corn
You have failed.
The goose has eaten the corn.
References
V. Anton Sprual. Think Like a Programmer: An Introduction to Creative Problem Solving.
No Starch Press, San Francisco, 2012.

热门主题

课程名

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
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图