代写COMP 3023、C++程序设计代做
COMP 3023 Design Patterns with C++
Assignment 1 COMP 3023
Introduction
In this individual assignment, you have been tasked by your client to create a command-line based
simulation game in C++. In the game the player controls a team of devoted robots working for the
company. Following the orders of the player, the robots have to perform dangerous exploration
missions in hazardous locations in order to collect scrap. The scrap can then be sold to reach quota
and unlock items that will increase the robot’s ability to work. Should the robots fail to meet the
quota in time, they will be shut down. The goal of the player is to manage assets (money, items,
robots and scrap) to keep the robots running for as long as possible.
Assignment and submission requirements
The assignment has the following requirements. Failing to address any of these requirements will
result in deducted marks.
1. The assignment must be submitted via CloudCampus.
2. You must the full source code and be written in C++.
3. It must build and run from Visual Studio 2022 on Windows.
4. The code must be compressed using the common ZIP compression.
5. The functioning executable must run from command line under Windows 10 or higher.
6. The output needs to be in English
Game overview
The game is a single-player asset management game, where the player tries to stay alive for as long
as possible. To do so, the player must meet a certain quota every 4 game days (also called a cycle).
Money is made by sending robots to locations where scrap can be collected, and then selling this
scrap later on.
Every day, the player chooses a location and orders robots to go on expeditions in an attempt to
collect scrap. Once the player chooses to leave the location, a new day begins. The player can also
choose to travel home where the collected scrap can be sold for cash.
The player does not control robots. Instead, they choose the number of robots they wish to send on
exploration missions, and a chanced-based simulation determines how much scrap is collected and
how many robots make it back.
At the beginning of each day, 4 robots are available. When landed on the location, robots may die
during expeditions. If all 4 robots are broken, the player is forced to leave the location and a new day
begins. Robots that broke during the day are repaired at the beginning of the next day so that all 4
robots are available again.
The player should also pay attention to the weather of the location they land on. At the beginning of
each day, the weather of each location is randomized. The weather will directly affect expedition
simulation parameters such as the amount of scrap that can be collected by robots, and/or the
survival chance of robots. To achieve all of these actions, the player uses a simple command system. All commands start with a
word (e.g. “land”, “leave”, etc.) and may be followed by any number of arguments.
Example session
1. A typical session would proceed as follows:
2. The player starts the game. They begin with a cargo value of $0 (no scrap), an initial balance
of $50, a first quota of $150, and no items. Day 1 starts, and the player at home.
3. The player uses the “locations” command to see what locations are available and what is
their current weather conditions.
4. The player makes a choice and uses the “route” command followed by the name of the
location they wish to route to select a location. They may use this command as many times
as they wish.
5. Once they made up their mind, the player uses the “start” command, which marks the
beginning of the landed phase.
6. The player begins the landed phase with 4 robots alive. They use the “send” command,
followed by the number of robots they wish to send to start an expedition.
7. A simulation algorithm takes over and determines the number of robots that make it back
alive as well as how much scrap they bring back based on parameters such as the chosen
location and items bought.
8. The player is told about the result of the expedition (e.g. “N robots made it back and brought
$X worth of scrap”). That scrap is added to the cargo value (and not to the balance). From
there, the player can re-use the “send” command as long as at least one robot is functioning.
If, however, all robots breakdown as part of an expedition, all the cargo is lost, and the player
leaves the location immediately.
9. When the player feels like they’ve collected enough scrap, they can use the “leave”
command to go back home. This will bring the current day to an end and start the next one,
with all 4 robots working again.
10. At that point, the player would typically repeat operations from step 2, 3, 4 or 5 up to 9.
11. Alternatively, if they’d like to sell the collected scrap for cash, they can choose to navigate to
home using the “route home” command.
12. On the corporation location, the player would use the “sell” command, either on its own to
sell all of their, or followed by an amount to sell only a fraction of it. This will effectively
convert to scrap into usable money (in other words, the cargo value is transferred to their
balance).
13. When done, the player uses the “leave” command, which would also mark the end of that
day.
14. At the end of every 4 days, the player is expected to meet quota (reach the predefined cash
threshold). Only the balance is considered, which means that the scrap must be sold before
the end of the 4th day. If they fail to do so, the game displays the number of days they have
survived before exiting. If they succeed, a new 4-day cycle begins with an increased quota.
The quota amount is not deducted from the player’s balance.
Implementation
Your assignment must design and implement at least the following classes:
Game — The Game object drives the game. The Game object:
• Is responsible for initialising a new game.
• Is responsible for defining the locations & items available to the game.
• Is responsible for showing the welcome screen.
• Is responsible for running the 4-day cycle loop and the day loops.
• Is responsible for reading, parsing and dispatching commands.
• Is responsible for handling the following commands:
o START
o LEAVE
o EXIT
• Is responsible for keeping track of the balance.
• Is responsible for keeping track of the location currently being orbited or landed on.
• Is responsible for keeping track of the game phase (orbiting or landing).
• Is responsible for keeping track of the cargo value.
• Is responsible for keeping track of alive employees.
• Holds the item manager, the location manager and the game’s random number generator
instance.
Location manager — Manages the locations and handles the related commands. The location
manager:
Keeps (a) data structure(s) containing all the locations defined by the Game, keeping the registration
order (e.g. the order in which locations have been defined).
Handles the following commands:
LOCATIONS
ROUTE
When implementing the location manager, we suggest having a function that will be called by
“Game” to register a location:
void registerLocation(AbstractLocation* location);
AbstractLocation — Represents the base type of a location in the game. The AbstractLocation class
should be an abstract class so that differences between the corporation location and other locations
can be handled properly. A location should:
• Have a name
• Contain an description for the weather conditions it is currently experiencing.
• Handle the following commands:
o SEND
o SELL
• Print a welcome message that will be displayed after reaching the location
When implementing AbstractLocation, define an enum for weather conditions: (Clear, Flooded,
Eclisped, Stormy). Add a function that returns its name:
const std::string& name() const;
Have a function that will be called by the game when a day begins:
virtual void onDayBegin(Game& g);
Have functions that handle the SELL and SEND commands:
virtual void sellCargo(Game& g, int amount) = 0;
virtual void sendEmployees(Game& g, int count) = 0;
Hints and tips
Random number generation. C++’s random number generation is relatively complex. It features
different number generators and its syntax is a bit uncanny. To use it, make sure to create a single
number generator instance that you will re-use everywhere in your code. For that, we will use
mt19937 (MT19937 is one of many random number generator implementation):
#include std::mt19937
myGenerator(std::random_device{}());
You can then generate a random int between A and B (both inclusive) using the following code:
std::uniform_int_distribution intDistribution(A, B);
int myRandomNumber = intDistribution(myGenerator);
Similarly, you can generate a random float between 0.0 and 1.0 (1.0 excluded) using the following
code:
std::uniform_real_distribution realDistribution; float
myRandomNumber = realDistribution(myGenerator);

Simulation algorithm
The following pseudocode calculate and returns the outcome of an expedition:
numOperators = 4
robotSurvivalChance = robotsBaseSurvivalChance *
survivalChanceMultiplier
deadRobots = 0
REPEAT numRobots TIMES:
revenue = randomIntBetween(minScrapValue * scrapValueMultplier,
maxScrapValue *
scrapValueMultplier)
IF randomFloat01() < RobotsurvivalChance:
//This robot made it out alive
totalRevenue = totalRevenue + revenue
ELSE
totalRevenue = totalRevenue + revenue * lootRecoveryMultiplier deadRobots = deadRobots + 1
END IF
END REPEAT
RETURN deadRobots, totalRevenue

热门主题

课程名

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
站长地图