CHC5028 Software Development with
C/C++
Coursework
Important Dates
Week 10 (an available day in that week): Class test.
Week 12 (16/12/2024-20/12/2024): Project demonstration and viva assessment. Source
codes file submission.
Background
“Text adventures”, now called “interactive fiction”, were among the first type of computer
game ever produced. These games have no graphics; the player reads the story of the
game in text, and decides what their character will do by typing commands at a prompt.
Although less popular now, text adventures are still played and created, and developed
into the original online RPGs (MUDs). You can play some sample modern text
adventures here:
Discworld MUD, BatMUD,
These are playable online via a web browser. It is advisable to try out the games to get
an understanding of how the games behave.
For this coursework, you will be creating a simple game engine for a text adventure.
You are not required to write an actual adventure, only the back-end program code that
would support one. You will need to add some material to the program in order to test it,
but this may just be simple test material. You may add interesting descriptions or stories
to your program if you want to, but there are no marks for doing so.
You are provided with a CLion project containing a very simple game harness which
supports only two commands: going north (north or n), and quitting (quit). Extend it
by doing the exercises below. Note that the later exercises are less explicitly described
than the earlier ones, meaning that you must solve more problems yourself. This is
intentional.
The coursework is written to be built using gcc through CMake and CLion. It is not
recommended that you attempt to build it using Visual Studio or XCode.
Important: If you are building the sample coursework on a platform other than Windows, or
on a machine which does not have the Windows API installed, you may get an error in the
file wordwrap.c. This file calls a Windows specific function to find thewidth of the console. If
you get this error, remove the #include <windows.h> fromthe top of the file, and edit
the initWordWrap() function by deleting its contents andreplacing them with
consoleWidth = 80; currentConsoleOffset = 0;. You can change 80 here to any
number that makes the output comfortably readable.
Task 1 (10% of the mark)
In the current system, you can only move North. Extend the engine to allow movement inall
four compass directions.
• Add properties to the Room class for storing east, south, and west exits. These
properties will need accessor methods.
• Add code to the gameLoop method to understand the commands east, south, andwest
(and the abbreviations e, s and w) and to handle them in a similar way to north.
• Modify initRooms to create more rooms using the new exits to test yourcode.
• The rooms created should be constructed in a reasonable and logical relationship that
makes the game playable and sensible.
Task 2 (15% of the mark)
A key part of most text adventure games is the ability to move objects around. Objects
can be found in rooms and can be picked up and put down by the player. Add this
capability to the game engine.
• Create a GameObject super class. It should contain at least a weight, and a
keyword (for the player to use when typing commands).
• Modify the Room class so that each Room includes a list of GameObjects in theroom.
• Create a derived class Weapon of GameOjbect class, the weight of each object of
Weapon should be limited in a range of 5-10. It should contain a property named
harm which should be limited in a range of 10-30.
• Create a derived class Food of GameObject class, the weight of each object of Food
should be limited in a range of 1-5. It should contain a property named energy which
should be limited in a range of 1-10.
• Modify initRooms to create some GameObjects ((including food and weapon objects)
and put them in the rooms. Use this to test your program. (No marks are assigned
specifically for this task, but without it, the ones following cannot be demonstrated.)
Task 3 (15% of the mark)
A key part of most text adventure games is the ability to fight with the NPC enemy. The
NPC can be found in rooms and the player can fight with them. Add this capability to
the game engine.
• Create a pure virtual EnemyObject class. It should contain at least a health, and a
keyword (for the player to use when typing commands). It should contain a virtual
method damage().
• Modify the Room class so that each Room includes a list of EnemyObject in theroom.
• Create a derived class Boss of EnemyObject class, the health of each object of
Boss should be 100.
• Create a derived class Clowns of EnemyObject class, the health of each object of
Clowns should be 30.
• Modify initRooms to create some EnemyObjects ((including boss and clowns
objects) and put them in the rooms. Use this to test your program. (No marks are
assigned specifically for this task, but without it, the ones following cannot be
demonstrated.)
• You need to consider different reasonable damage value for each different
enemy objects’ damage() method.
Task 4 (5% of the mark)
• Modify the State class to include a representation of the player’s physical strength,
called strength, which is initiated as 100, and when strength goes to 0, the program
shall be terminated.
• Modify the Room::describe() method to print out the keywords of all theobjects in the
room, formatted as nicely as possible.
Task 5 (30% of the mark)
• Modify the gameLoop method to pay attention to the second word of the commandthe
player enters, if there is one. The following commands can be used with the second
word to search through a) objects in the current room,and b) objects in the inventory, for
an object with a keyword matching the second word of the command the player typed.
• Implement the player command get which, when typed with an object keyword, willmove
that object from the current room list into the inventory. It should display appropriate
errors if the object is not in the room, or the object is already in the inventory, or the
object does not exist.
• Implement the player command drop which, when typed with an object keyword, will
move that object from the inventory into the current room list. It should display
appropriate errors if the object is not in the inventory or doesnot exist, etc. (5%)
• Implement the player command inventory which will print out the keywords ofall the
objects in the inventory.
• Implement the player command eat which, when typed with a food object
keyword, will print out the player’s strength after adding the energy of the food
object to the player’s strength, which should not exceed 100.
• Implement the player’s command fight which, when typed with an enemy
object keyword if the enemy object exists in the room, will print out the enemy’s
health that subtracts from the sum of harm of weapons carried by the player.
• The harm is mutual, the player’s strength should reduce the damage of the
enemy existing in the room and be printed out. You need to make the damage()
in the Boss and Clowns class can be applied when the fight command is
working.
• You need to make the printout of each command execution demonstrate the
explicit status of all objects in the room.
Task 6 (25% of the mark)
Since most players will not want to play an entire game at one sitting, most games include
save and load (or restore) commands. Implement these commands. Theyshould ask the
user for a filename and then write or read the current game state, to orfrom that file.
Note that the layout and descriptions of rooms, and the list and descriptions of objects,are not
part of the game state because they do not change during the game. These should not be
included in the save file and saving them will lose marks.
A simple file open, load, and save does not guarantee full marks and may notguarantee
“a good mark”.
To this end, some important points to consider:
• The “game state” may also include the locations of objects the player has dropped in
rooms. Would it be a good idea to restructure how object locations are stored?
• The “game state” may also include the status of the player and enemy objects. Would it
be a good idea to restructure these objects to the original situation?
• The State object stores the current room, and objects, using pointers. Pointers cannot
safely be written to disk since addresses may be different when the programis reloaded.
How can you enable this data to be safely saved and reloaded?
• It is worth ensuring to some degree that the user cannot readily cheat, or spoil the game,
by reading or changing a save file. While it is not necessary to implement actual
authentication or encryption, at the same time, the file does not have to be just a text
dump. This makes it harder to parse when loaded. So, for example, saving the required
indexes into a static array of strings may be a better way than saving the strings
themselves.
Marking scheme for this task:
• 5% for basic correct structure of I/O.
• 10% for the file format designed for storing the saved game.
• 10% for the code that performs the save and the load.
Assessment Rules( Very important )
Code will be assessed by a demonstration and viva in week 12. You will be asked to
demonstrate your code and to explain how it works. There is no hard division of
marksbetween code and viva. The marks given are mainly based on your performance
in answering the assessor's questions and the accuracy and correctness of the
corresponding answers.
If you cannot explain your code sufficiently well to satisfy the assessor that it is your
own work, they have the right to award 0 marks for that exercise, regardlessof the
quality of the code.
The fact that your code works does not guarantee full marks. All code is expected to
also be readable, maintainable, and efficient. You are not required to exactly follow the steps
in the exercises above. Alternative designs are also acceptable if they can bejustified in the
viva. However, designs which substantially reduce efficiency or other desirable properties
without corresponding benefits will lose marks.
• The deadline for submission of the coursework is Week 12.
• In Week 12 you will also be required to demonstrate the final version ofyour
work, and verbal feedback will be given.
In addition to final submission and viva in Week 12, there will be two counselling in
the week 10 and week 11 tutorial periods. You also can make appointments with the
tutor during the whole semester to
Notice on presentation and submission
You do not need to give a presentation nor submit a report for either section of the
coursework. This coursework’s focus is on the quality of your final code and on your ability to
understand it, not your software engineering process (which is not expected tobe standard
when you are learning the language).
Standard rules on plagiarism apply to this coursework.
The Code should be your own work and must not be copied from the internet or any
other source. If you have difficulty with the coursework, you should approach your practical
tutor in the first instance. Posting questions about the coursework on Stack Overflow, Quora,
or similar sites may be treated as an incitement to plagiarism. Posting parts of your answer to
the coursework on the publicly available internet where other students may access it will be
treated asan incitement to plagiarism. Soliciting or obtaining answers to the coursework in
exchange for money and any other consideration will be treated as serious academic
misconduct. Asking for coursework answers from any party outside of the University is itself
attempted plagiarism and you should not do it; if that third party commits any of theoffenses in
this section on your behalf, you may be held responsible, even if you were not directly aware
they would do so (because you should not have asked them in the first place).
Assignment Data
Contact person Leon Liang, leon@zy.cdut.edu.cn
Learning outcomes See below.
Formative deadline Week 10 (2/12/2024-6/12/2024):
Coursework Class Test
Formative feedback Week 10 (2/12/2024-6/12/2024):
Counselling
Week 11 (9/12/2023-13/12/2023):
Counselling
Summative deadline Week 12 (16/12/2024-20/12/2024)
Coursework project demonstration and viva
Summative feedback Week 12 (18/12/2023-22/12/2023)
Spoken interactive(viva)
Final marks after assessment committees
Assignment Weighting Coursework class test 20% of the module
Coursework project demonstration and viva 30% of the
module
Learning Outcomes
• Understand the fundamental concepts of C and C++ programming for object
manipulation, data structuring and input/output control.
• Refine a problem specification into a collection of C++ classes.
• Create a software artefact specified in terms of C++ objects and their interrelations.
• Research the techniques for safe and efficient programming in C and C++.
相关推荐
压液氧(LOX)火箭发动机涡轮泵级建立了一条自动化的基于模型的系统工程(MBSE)与多学科设计优化(MDO)流水线.rar
压液氧(LOX)火箭发动机涡轮泵级建立了一条自动化的基于模型的系统工程(MBSE)与多学科设计优化(MDO)流水线.rar
CHC5028 Software Development C/C++
C/C++CourseworkBackgroundworking.module。
在加性高斯白噪声和瑞利衰落信道上,针对BPSK_QPSK的误码率性能的MATLAB仿真,并扩展了相位优化的可重构智能表面辅助链路对比.rar
在加性高斯白噪声和瑞利衰落信道上,针对BPSK_QPSK的误码率性能的MATLAB仿真,并扩展了相位优化的可重构智能表面辅助链路对比.rar
CHC5028 Software Development with C/C++
Discworld MUD, BatMUD, 北大侠客行。
python 操作海康威视工业相机资源例子--ParametrizeCamera_LoadAndSave.zip
python 操作海康威视工业相机资源例子--ParametrizeCamera_LoadAndSave
数字农业与乡村振兴行业可信数据空间应用规划方案(专项申报版).pptx
数字农业与乡村振兴行业可信数据空间应用规划方案(专项申报版).pptx
【FDE知识库】(1):AI 编程时代开发语言选型分析,云使用go,企业用java,算法python,底层c
AI 编程时代,开发语言选型需综合考量AI适配度、编译速度、跨平台与学习成本。Python以海量语料和即时执行成首选,适用于AI/ML与原型开发;TypeScript凭借类型系统与秒级构建,成为前端及应用层主流;Go以极速编译与统一风格,契合AI代理高效迭代需求。Rust/C++虽性能强,但编译慢、学习成本高,不适于快速试错。综合推荐:优先选Python、TypeScript、Go,兼顾效率与生态,实现最优AI协作体验。
基于斜坡补偿的Buck电路峰值电流+电压电流双闭环控制【附说明文档】(Simulink仿真实现)优快云首页发布文章优快云同步助手LLC谐振变换器开环+闭环软启动仿真设计(Simulink
内容概要:本文围绕三电平VIENNA整流器的双闭环控制与中点电位平衡问题展开仿真研究,提出了一种基于上下电容电压差值补偿的中点电位平衡策略。该策略在传统电压电流双闭环PI控制的基础上,引入电容电压差值作为反馈信号,通过SVPWM调制中冗余小矢量的时间分配实现中点电荷的定向调节,从而在不改变主控制结构的前提下有效抑制中点电位偏差。仿真结果表明,该方法不仅确保直流母线电压稳定跟踪800V给定值,还能显著提升上下电容电压的均衡度,同时保持输入电流低谐波水平,验证了控制策略的可行性和有效性。; 适合人群:电力电子、电气自动化及相关专业的研究生、科研人员及工程技术人员,具备一定的MATLAB/Simulink仿真基础和电力电子拓扑知识背景者更佳。; 使用场景及目标:①掌握三电平VIENNA整流器的工作原理与中点电位波动的成因;②理解电压电流双闭环PI控制的设计要点与参数整定原则;③学习基于差值补偿的中点电位平衡控制策略及其与SVPWM的协同机制;④应用于充电桩、航空电源、通信电源等中大功率单向整流场合的控制系统设计与优化。; 阅读建议:建议结合文中提供的仿真模型与参数设置进行动手实践,重点关注中点电位平衡投入前后电容电压波形的变化,对比分析不同工况下的系统动态响应,深入理解控制策略的作用机理。同时可进一步探索在电网不平衡、轻载等复杂工况下的控制性能,以拓展应用场景。
具有PWM控制VSC-HVDC链路的IEEE30总线传输系统(Simulink仿真实现)
内容概要:本文详细介绍了在Simulink环境中构建和仿真一个集成PWM控制的电压源换流器型高压直流输电(VSC-HVDC)链路的IEEE30节点电力传输系统的研究工作。该模型聚焦于利用PWM技术实现对VSC的高效、精确控制,以提升电力系统的传输效率、动态响应能力和运行稳定性。研究涵盖了系统整体建模、关键设备参数设计、PWM控制策略的实现、以及在标准IEEE30节点系统上的集成方法。通过一系列仿真测试,包括系统在正常运行、负载突变及故障条件下的动态响应,全面分析了VSC-HVDC链路对改善电网电压稳定性、优化潮流分布和增强系统可靠性的具体作用,充分验证了所提方案的有效性和工程应用价值。; 适合人群:具备电力系统分析、高压直流输电技术基础理论知识及Simulink/MATLAB仿真软件操作能力的高校研究生、科研机构研究人员和电力行业工程师。; 使用场景及目标:①作为教学案例,帮助学生深入理解VSC-HVDC的工作原理、控制策略及其在复杂电网中的集成应用;②为电力系统规划与运行人员提供一种可靠的仿真工具,用于评估新型输电技术对现有电网性能的影响,支持电网升级改造决策;③推动VSC-HVDC技术在远距离大容量输电、新能源并网和智能电网建设等领域的创新应用。; 阅读建议:建议读者在学习过程中,结合电力系统稳态与暂态分析的相关理论,重点关注PWM控制模块和VSC的建模细节,动手复现并调试所提供的Simulink模型,通过改变系统参数和运行工况来观察仿真结果的变化,从而深化对VSC-HVDC系统动态特性的理解。
自适应多机器人编队规划,以包围和跟踪具有运动和可见性约束的目标(Matlab代码实现)
内容概要:本文针对“自适应多机器人编队规划,以包围和跟踪具有运动和可见性约束的目标”开展研究,提出一种基于Matlab的仿真方法,实现多机器人在动态环境中对移动目标的协同包围与持续跟踪。该方法综合考虑了机器人的运动学约束与传感器的视线(visibility)限制,设计了分布式控制策略与自适应编队算法,能够在复杂环境下有效维持编队结构的稳定性和任务执行的鲁棒性。研究详细阐述了系统建模过程、控制律设计原理、编队形成与保持机制,并通过Matlab代码实现了完整的仿真验证,展示了算法在不同动态场景下的适应能力与性能优势; 适合人群:具备机器人学、自动控制理论、多智能体系统等相关基础知识,熟悉Matlab编程语言,从事智能系统、协同控制、路径规划与自主导航等方向的研究生、科研人员及工程技术人员; 使用场景及目标:①应用于安防监控、环境探测、灾害救援等场景中的多机器人目标围捕与跟踪任务;②为多智能体协同控制、分布式编队保持、避障与可见性维护等关键技术提供可复现的算法框架与仿真平台;③辅助高校与科研机构在相关领域的教学演示与科研创新,深化对自适应控制与分布式协同机制的理解; 阅读建议:建议读者结合提供的Matlab代码逐模块分析其实现逻辑,重点关注控制律设计、约束处理与自适应机制部分,可通过调整机器人数量、目标轨迹、传感器参数等进行扩展性实验,以深入掌握多机器人协同系统的动态行为与优化方法。
patch_1.23.0.2584_game_No6.android.pak
patch_1.23.0.2584_game_No6.android.pak
基于变频控制的多相交错LLC谐振变换器闭环仿真(Simulink仿真实现)
内容概要:本文详细介绍了基于变频控制的多相交错LLC谐振变换器的闭环仿真设计,重点阐述了其在Simulink环境下的建模与控制策略。通过多相交错技术有效降低输出纹波电流,提升系统效率与功率密度,并采用变频控制(PFM)实现对谐振变换器输出电压的精确调节。文中构建了完整的闭环控制系统,包含电压外环与电流内环,确保系统在负载变化或输入波动等扰动工况下仍能稳定运行。同时,配套提供了仿真模型、参数设计计算书及参考文献,帮助读者深入理解系统设计流程与关键技术细节,具有较强的工程复现价值。该资源适用于电力电子、新能源变换器等相关领域的仿真研究与教学实践。; 适合人群:具备电力电子基础知识,熟悉Simulink仿真工具,从事电源变换器设计、新能源系统研发或相关专业的研究生及工程技术人员。; 使用场景及目标:①掌握多相交错LLC谐振变换器的工作原理与变频控制机制;②学习并实现基于Simulink的闭环控制系统建模与仿真;③理解谐振参数设计、软开关实现及系统稳定性分析方法;④为科研项目、毕业设计或产品原型开发提供可复用的技术参考与仿真平台。; 阅读建议:建议读者结合提供的仿真模型与计算书,逐步完成系统搭建与参数整定,重点关注变频控制逻辑与闭环响应特性。在仿真过程中,可通过调整负载、输入电压等条件,观察系统的动态响应与稳态性能,加深对多相交错与谐振控制优势的理解。同时推荐参考相关文献,拓展对LLC变换器前沿控制策略的认识。
状态估计【卡尔曼滤波kalman】UKF、EKF、粒子滤波PF学习与研究(Matlab代码实现)
内容概要:本文系统地研究了无迹卡尔曼滤波(UKF)、扩展卡尔曼滤波(EKF)和粒子滤波(PF)在非线性系统状态估计中的理论基础与实际应用,并结合Matlab代码实现进行了深入剖析。内容涵盖三种滤波算法的核心原理、数学推导及其在轨迹估计等工程问题中的具体实施方法。通过详尽的Matlab编程实例,展示了如何利用这些先进滤波技术解决如目标跟踪、传感器融合等复杂问题,并特别探讨了BP神经网络与EKF结合的优化训练策略以及粒子滤波在提高状态跟踪精度方面的潜力。该资料为希望掌握现代状态估计算法的研究人员和技术爱好者提供了一套完整的理论与实践指南; 适合人群:具备一定编程基础,尤其是熟练使用Matlab工具,且对控制理论、信号处理或相关工程技术领域有初步了解的研发人员和高校学生; 使用场景及目标:① 深入理解UKF、EKF和PF的基本概念及其在非线性动态系统中进行状态变量估计的应用;② 通过Matlab代码实践加深对各滤波器工作机制的理解,能够独立开发相应的算法以应对诸如轨迹预测、多源信息融合等实际挑战;③ 探索将BP神经网络与EKF相结合的新途径,以期提升模型的学习效率和预测准确性; 阅读建议:此资源不仅提供了坚实的理论支撑,还包括丰富的代码示例,建议读者按照文档结构循序渐进地学习,同时动手实现每一个案例,以便更深刻地把握各种滤波技术的关键细节。对于致力于深入研究状态估计领域的专业人士而言,这是一份极具价值的学习材料。
两路半桥LLC谐振变换器软开关Simulink仿真(模拟谐振参数不同、分裂电容)
内容概要:本文详细介绍了两路半桥LLC谐振变换器软开关的Simulink仿真研究,重点模拟了不同谐振参数及分裂电容对系统性能的影响。通过建立精确的电路模型,分析了软开关实现条件、谐振腔参数变化对电压电流波形、效率及功率传输能力的作用机制,探讨了分裂电容结构在改善均流特性与提升系统稳定性方面的优势。仿真结果有助于深入理解LLC变换器的工作原理与动态响应特性,为高频高效电源设计提供理论支持与优化方向。; 适合人群:电力电子、电气工程及其自动化等相关专业的科研人员、研究生及从事开关电源设计的工程师。; 使用场景及目标:①掌握LLC谐振变换器的基本建模与仿真方法;②研究谐振参数(如谐振电感、电容)对软开关过程的影响规律;③分析分裂电容结构在多路并联变换器中的均流与稳定性作用;④为高频高效DC-DC变换器的设计与优化提供仿真依据和技术参考。; 阅读建议:建议结合Simulink模型逐步操作,关注关键波形的观测点,对比不同参数下的仿真结果,深入理解软开关的实现条件与系统动态特性,同时可进一步拓展至效率分析与热管理设计。
DXF、DWG工程制图文件查看器
DXF、DWG工程制图文件查看器。 可以在界面中进行测量(包括距离、面积、角度等等) 无需版权,放心使用。
含分布式电源的配电网可靠性评估研究(Matlab代码实现)
内容概要:本文围绕含分布式电源的配电网可靠性评估展开研究,基于Matlab代码实现相应的评估模型。研究内容涵盖分布式电源接入对配电网运行特性的影响,采用序贯蒙特卡洛模拟法等可靠性评估方法,对系统在不同运行场景下的供电可靠性指标进行量化分析。通过构建典型配电网模型,仿真分析分布式电源的位置、容量及出力特性对系统可靠性的影响机制,进而为提升配电网韧性与供电质量提供理论支撑和技术手段。研究不仅关注理论建模,还注重实际仿真流程的可操作性与结果的可视化呈现。; 适合人群:具备电力系统基础知识,从事配电网规划、运行与可靠性分析等相关领域的科研人员及工程技术人员,尤其适合研究生及从事新能源并网研究的1-3年工作经验的专业人员。; 使用场景及目标:①掌握含分布式电源的配电网可靠性评估基本理论与方法;②学习并复现主流可靠性评估算法(如蒙特卡洛模拟)的Matlab编程实现;③分析分布式电源接入对系统可靠性的影响规律,支撑配电网优化规划与运行决策。; 阅读建议:建议读者结合电力系统可靠性教材与本文Matlab代码同步学习,重点关注模型构建逻辑与算法实现细节,动手调试代码以加深对评估流程的理解,并尝试在不同网络结构和电源配置下进行仿真对比分析。
数控基础知识数控加工工序的安排原则
数控基础知识数控加工工序的安排原则
【MBD开发】Simulink中的枚举
01 什么是枚举 按百度百科的词条【枚举】是在编程语言中用来存储一组固定的常量。不同编程语言的枚举语法也不一样,以C语言为例。 typedef enum{ GEAR_P, //0:P挡 GEAR_R, //1:倒挡 GEAR_N, //2:空挡 GEAR_D, //3:前进}_GEAR; 上面枚举了一个_GEAR数据,用GEAR_P表示0,GEAR_R表示1…… if(current_gear==GEAR..
1034



被折叠的 条评论
为什么被折叠?



