program代做、代写C++设计编程
Homework: Pong
Goal
Reimplement the classic arcade game ‘pong’ using SDL2. More information on the game ‘pong’ can be found
Core Requirements
The following core requirements should be implemented (the weight of each requirement is provided for your convenience):
• The game should be played in an 1024x768 window. Changing the size of the window should be disabled (10%).
• A well-defined game loop that coordinates game timing and event management (20%).
• A single player version should be implemented where the user controls a single paddle (15%), and the computer the other paddle (15%). The paddle can be moved by keyboard or mouse
(one method of control is sufficient). The paddle of both the player and the AI should move at a constant speed.
• A ball should bounce of the top and bottom edge of the playfield and the direction of the ball should change to the reflected direction (15%). To add an element of uncertainty, a small
random perturbation could be added/subtracted from the reflected direction (5%).
• A player scores when the ball hits the edge of the competitors’ side (5%).
• The game starts with both players having zero points, and ends when one player reaches 11 points. A message should be shown to indicate whether the player won or lost. The player should have the option to restart the game or quit (10%).
• The current score should be shown in the window (5%).


Bonus Features
In addition to the above core requirements, additional bonus points can be obtained by implementing one or more of the bonus features listed below.
• Additional support for correct resizing and maximization of the window (10%). As well as pausing of the game when the window is minimized (5%).
• Add sounds when hitting a wall, pad, or when the ball is leaving the screen (15%).

• Make the pad moveslower when just starting to move, and accelerate the longer the pad is moving in the same direction up to some maximum speed (10%).
• Take the speed and direction of the pad motion in account when computing the reflected direction (15%).
• Add obstacles (10%).
• User selectable difficulty by setting the game speed (i.e., more difficult == faster game) (10%).
• Add a title screen with selectable options (e.g., which pad to play with, difficulty level, etc...) (15%).
• Add randomly placed power-ups that can be enabled to hitting it with a ball (e.g., hold ballon pad, safety net behind pad, double size pad, etc..) (10%).
• Something else creative (?%)


Practical
This homework should be solved using the SDL2 library (we use SDL version 2; we will not use the legacy 1.x SDL version, or the recent SDL3). Precompiled libraries exists for a wide variety of operating systems and C++ compilers. SDL2 should be preinstalled on the lab machines. This homework also relies on
CMake (http://www.cmake.org) to provide cross platform Makefile support (CMake supports both
Linux and Windows). Linux or OSx requires minimal additional packages to be installed (Ccompiler,
CMake, and SDL2). Many distributions include precompiled packages (note: when installing SDL2 also
include the ‘development’ version if available). For windows I recommend using MSYS2 with MinGW64 as C++ compiler. Warning, windows setups area bit more complicated, so start early. Please refer to the README.txt file of the skeleton code for detailed setup instructions for Windows-based machines.
A skeleton-code that provides a basic SDL2-based ‘Hello World’ program. You will need to request access to the repository (open the URL in your web-browser, login, and select the three dotson the right next to the project title). Once
you have you should ‘fork’ the project as private in your own code.wm.edu code repository (button on the right next to the title). Next, goto Manage->Members and invite me (ppeers) as “maintainer” (the default is “guest” which is not sufficient), with an expiration date of 06/01/2025. Next, create a token (or setup an ssh key and use git:// instead of https:// below): Settings->Access Tokens (set your role as Owner, and enable all options). You can now clone the project with :
git clone https://code.wm.edu//CSCI437-Pong.git
(replace with your WM username) to your local computer, where you can make any
alterations. Do not forget to commit your changes (git commit -am ‘Description of change’) and push your commits to the server (git push).
It is highly recommended to start from this skeleton code; you must use the CMake configuration. To
compile the skeleton code (see the included README.TXT), create a subdirectory ‘Debug’,and from
within this ‘Debug’ directory run'cmake ..' to generate the Makefile. SDL2 might not be found if it is not

installed in a standard location. You can specify to cmake where to search for SDL2 via the “-DSDL2_PATH=” option:
cmake -DSDL2_PATH=/home/me/nonstandardlocation/SDL2 ..
Don’tforget the ‘dot dot’ at the end. If you want to use a different compiler than the default (on linux or OSX) or in case there is no default compiler (Windows), you will need to specify to cmake for which compiler to generate Makefiles for. For example, if you want to use mingw64 as the compiler, then:
cmake -G “MinGW Makefiles” ..
Please run ‘cmake’ without arguments to get the full list of compile targets. Note, if you want to change your compile target, it is best to fully remove the ‘Debug’ directory, and recreate it.
Normally, you do not need to rerun cmake, unless in the situation described below. The CMake files in this skeleton have been setup to simplify adding files without the need to alter the CMake files:
• If you want to add a new executable, just add the corresponding ‘ .cpp’ file in the 'bin'
subdirectory, and rerun 'cmake ..' to update the Makefiles. This cpp file should contain a ‘ main’ function.
• If you want to add a source file, just add the corresponding ‘ .cpp’ file in the 'src'subdirectory, and rerun 'cmake ..' to update the Makefile. These source files should not contain a ‘ main’
function.
• If you want to add a header file, just add the corresponding ‘ .h’ file to the 'include' subdirectory. You do not need to update the Makefile by rerunning cmake.
• Adding an external library requires more work – you will need to add a FindPackage entry in the CMakeLists.txt file. Please refer to how SDL is added in the included CMakeLists file as a template.
In case you want to remove all compiled files, just remove the ‘Debug’ directory. Based on the directory name,cmake will generate a makefile to compile your code in either Debug or Release mode. In Debug mode, debug information is included in your executable, and certain checks are included. Release mode, runs faster, but it is advised to on use this when you know your code works. To compile in release mode, just create a directory ‘Release’,and run ‘cmake ..’ from within this directory.

Submission Details
Fork your own version of the homework code skeleton as soon as possible. Granting access requires me to take action, and thus is not instantaneous. Do not change the repo name I will clone your project on or after the deadline, and use the cloned version to grade your project. Make sure you have your final version committed by the deadline
and you have added me as “ maintainer” to your repo (preferably as soon as you fork the repo)! The delay between the deadline and granting me access (as “ maintainer”) will be counted as a late

submission. In addition, by the deadline you need to add a PDF report (max 1 page) in the root of the forked repository, named ‘report.pdf’ (git add report.pdf) that contains the following information:
o Time required to finish the core requirements this homework
o Time spend on the bonus features (if any).
o A list of any external libraries (besides STL or Boost) that you used and why.
o A list of core features that do not work correctly.
o A list of implemented bonus features, indicating whether they work or not.


Remarks
• The estimated time required for the basic requirements is 16 hours, excluding time to master C++.
• This homework accounts for 2/9th of the total for this course. Additional bonus credits (max 1/9th) can be obtained by implementing the bonus features.
• The grading for this homework will be as follows:
o 5% whether or not your code compiles (without excessive changes to the compile process).
o 50% on correctness and playability. Does the ball move correctly? Can the pad be
moved correctly? Are scores being tracked? Does the game end? The percentages
listed in the ‘core requirements’ and ‘bonus features’ pertain to this component of the grade.
o 25% on code quality. See below.
o 15% on the separation in the code of logic versus view(s).
o 5% on the report.
• This is not a group project; this homework should be solved alone.
• You are not allowed to use existing SDL pong solutions found online - your code will be
compared to available online solutions, and if a (partial) match is found, you will receive 0 credits.
• You are allowed to use external libraries, but you will need to justify their use in your report. In general, external libraries should be used sparingly. If in doubt, contact the lecturer.
• Late policy: score -= ceil(hours_late / 24) * 10. Negative scores are possible. An extension needs to be requested at least 48 hours before the deadline. Each extension request needs to clearly justify why the extension is needed.

Code Quality Criteria
• Clean readable code. Feel free to pick any bracketing style you prefer, but be consistent. Indentation help is making the code readable. Use a consistent indentation style.
• Sufficient comments.
• Your code should be Object Oriented. There should not be many functions or constants not contained in a class. Each class should be meaningful; a near-empty class or a data container is

only needed in exceptional circumstances. Similarly, avoid putting (almost) all code in a single big class. If you class exceeds 250 lines of code, you should carefully consider if your design is good.
• Your class should enforce access via access specifiers (public and private). Your code should expose the very minimum of its internals.
• Only when a user is allowed to alter class data members without limits or side-effects, only then should a user from outside the object have direct access to data members; use getter and setter methods otherwise.
• Methods should be placed in the proper class. A method should only alter the state of the
object it belongs to (it can call modifiers on another class). An object should never be
responsible to keep the state of another object consistent. For example, a ‘Game’ object should never have to worry about whether any coordinate of a ‘ Ball’ object’s position is positive. This is an example that the position of the ‘ Ball’ should be private, and the set method in ‘ Ball’ should check the condition (i.e., position remains positive).
• Each class should have its own header file and source file. There should not be anything else in the header/source file.
• Each header file should have proper #ifndef guards (see CPP overview lecture). No #pragma
• Pass method parameters by reference. Only when passing basic data types (Boolean, int, char, float, double, long, pointers) may you pass them by value. Avoid passing pointers as a
parameter unless the variable was originally declared a pointer.
• Correct use of ‘const’ on both parameters being passed to methods, as well as the methods
themselves (see C++ overview lecture). In general, if a method does not alter the object, then it should be declared const (e.g., void getValue(void) const). Furthermore, if a variable is passed by reference and its content will not be altered by the method, then pass as const (e.g., void
addHealth(constint& increment)).
• Data that is always passed as whole, likely needs to have its own container class/type. For example: void setColor(const Color& col) instead of void setColor(int r, intg, int b);
• Do not use SDL data types to pass data to non-SDL methods. For example, don’t use SDL_Point to represent 2D points. Write your own point class. The reason for this is that you want to
have a strict separation between view and logic (SDL should be fully contained in the view). You can add methods in your data containers to cast to SDL types.

热门主题

课程名

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