CSSE7201作业代做、代做Electrical Engineering作业、代做C++程序设计作业、C++课程作业代做
project.c. You may need to look at the AVR C Library documentation to understand some of thefunctions used.Academic Merit, Plagiarism, Collusion and Other MisconductYou should read and understand the statement on academic merit, plagiarism, collusion and othermisconduct contained within the course profile and the document referenced in that course profile.You must not show your code to or share your code with any other student under anycircumstances. You must not post your code to public discussion forums or save your codein publicly accessible repositories. You must not look at or copy code from any other student.All submitted files will be subject to electronic plagiarism detection and misconductproceedings will be instituted against students where plagiarism or collusion is suspected.The electronic plagiarism detection can detect similarities in code structure even if comments,variable names, formatting etc. are modified. If you copy code, you will be caught. CSSE2010 / CSSE7201 Project, Semester 1, 2019 2Grading NoteAs described in the course profile, if you do not score at least 15% on this project (before any latepenalty) then your course grade will be capped at a 3 (i.e. you will fail the course). If you do notobtain at least 50% on this project (before any late penalty), then your course grade will be cappedat a 5. Your project mark (after any late penalty) will count 20% towards your final course grade.Resubmissions prior to grade finalization are possible to meet the 15% requirement in order topass the course, but a late penalty will be applied to the mark for final grade calculation purposes.Program DescriptionThe program you will be provided with has several C files which contain groups of relatedfunctions. The files provided are described below. The corresponding .h files (except for project.c)list the functions that are intended to be accessible from other files. You may modify any of theprovided files. You must submit ALL files used to build your project, even if you have notmodified some provided files. Many files make assumptions about which AVR ports are used toconnect to various IO devices. You are encouraged not to change these. project.c – this is the main file that contains the event loop and examples of how timebasedevents are implemented. You should read and understand this file. game.h/game.c – this file contains the implementation of the operations (e.g. movements)in the game. You should read this file and understand what representation is used for thegame. You will need to modify this file to add required functionality. buttons.h/buttons.c – this contains the code which deals with the IO board push buttons.It sets up pin change interrupts on those pins and records rising edges (buttons beingpushed). ledmatrix.h/ledmatrix.c – this contains functions which give easier access to the servicesprovided by the LED matrix. It makes use of the SPI routines implemented in spi.c pixel_colour.h – this file contains definitions of some useful colours score.h/score.c – a module for keeping track of and adding to the score. This module isnot used in the provided code. scrolling_char_display.h/scrolling_char_display.c – this contains code which providesa scrolling message display on the LED matrix board. serialio.h/serialio.c – this file is responsible for handling serial input and output usinginterrupts. It also maps the C standard IO routines (e.g. printf() and fgetc()) to use the serialinterface so you are able to use printf() etc for debugging purposes if you wish. You shouldnot need to look in this file, but you may be interested in how it works and the buffer sizesused for input and output (and what happens when the buffers fill up). spi.h/spi.c – this file encapsulates all SPI communication. Note that by default, all SPIcommunication uses busy waiting – the “send” routine returns only when the data is sent.If you need the CPU cycles for other activities, you may wish to consider converting thisto interrupt based IO, similar to the way that serial IO is handled. terminalio.h/terminalio.c – this encapsulates the sending of various escape sequenceswhich enable some control over terminal appearance and text placement – you can callthese functions (declared in terminalio.h) instead of remembering various escapesequences. Additional information about terminal IO will be provided on the courseBlackboard site. timer0.h/timer0.c – sets up a timer that is used to generate an interrupt every millisecondand update a global time value.CSSE2010 / CSSE7201 Project, Semester 1, 2019 3TerminologyThe figure below illustrates the terminology used in the game and the initial positions of theasteroids, and a projectile after it has been fired from the base station.Initial OperationThe provided program responds to the following inputs: Rising edge on the button connected to pin B3 Serial input character ‘L’ or ‘l’ (lower case L) Serial input escape sequence corresponding to the cursor-left keyAll of these move the base station left by one position.The program also responds to: Rising edge on the button connected to pin B2 Serial input character ‘ ’ (i.e. space) Serial input escape sequence corresponding to the cursor-up keyAll of these cause a projectile to be fired from the base station (provided there aren’t too manyprojectiles in flight already).The program also responds to: Rising edge on the button connected to pin B0 Serial input character ‘R’ or ‘r’ Serial input escape sequence corresponding to the cursor-right keyAll of these are intended to move the base station right by one position but currently move thebase station left by one position.Code is present to detect the following, but no actions are taken on these inputs: Rising edge on button connected to pin B1 Serial input escape sequences corresponding to the cursor down key Serial input characters ‘p’ and ‘P’ (intended to be the pause/unpause key)CSSE2010 / CSSE7201 Project, Semester 1, 2019 4Program FeaturesMarks will be awarded for features as described below. Part marks will be awarded if part of thespecified functionality is met. Marks are awarded only on demonstrated functionality in the finalsubmission – no marks are awarded for attempting to implement the functionality, no matter howmuch effort has gone into it, unless the feature can be demonstrated. You may implement higherlevelfeatures without implementing all lower level features if you like (subject to prerequisiterequirements). The number of marks is not an indication of difficulty. It is much easier to earnthe first 50% of marks than the second 50%.You may modify any of the code provided and use any of the code from learning lab sessionsand/or posted on the course Blackboard site. For some of the easier features, the description belowtells you which code to modify or there may be comments in the code which help you.Minimum Performance (Level 0 – Pass/Fail)Your program must have at least the features present in the code supplied to you, i.e., it must buildand run and show an asteroid field, allow the base station to be moved and allow projectiles to befired. No marks can be earned for other features unless this requirement is met, i.e., your projectmark will be zero.Splash Screen (Level 1 – 4 marks)Modify the program so that when it starts (i.e. the AVR microcontroller is reset) it scrolls amessage to the LED display that includes your student number. You should also change themessage output to the serial terminal to include your name and student number. Do this bymodifying the function splash_screen() in file project.c.Move Base Station Right (Level 1 – 4 marks)The provided program only moves the base station to the left (in response to the buttons andkeypresses described above). You must complete the move_base() function in file game.c inorder to enable the base station to be moved to the right also.Base Station Limits (Level 1 – 6 marks)The provided program allows the base station to move off the display. You must modify themove_base() function in game.c in order to prevent this. (The turret should be permitted tomove to the edge columns – i.e. the edge of the base station is off the display, but the base stationis able to fire projectiles up any of the columns.)Hit Detection (Level 1 – 10 marks)Modify the program so that it detects when a projectile hits an asteroid and removes both theprojectile and the asteroid from the game field. You will need to modify theadvance_projectiles() function in the file game.c and make use of other functions ingame.c.Note that hits may include those at point blank range, i.e. an asteroid is immediately above theturret – and the projectile may not even be visible in this case.Replacement Asteroids (Level 1 – 10 marks)(This assumes that you have implemented “Hit Detection” above and are removing asteroids whenhit.) Modify the program so that any asteroid removed is replaced by a new asteroid in a randomposition, not already occupied and not in the lowest three rows. Consult the code ininitialise_game() in game.c for ideas on how to randomly place asteroids. (If “FallingAsteroids” is implemented (see below) then replacement asteroids should appear in a randomcolumn in the top row – not already occupied by an asteroid or projectile.)CSSE2010 / CSSE7201 Project, Semester 1, 2019 5The number of asteroids in the game (20) should not reduce, but if the top row if full, it ispermissible to either add a replacement asteroid in the second row (or third if the second row isalso full) or wait until there is space in the top row (e.g. after one or more asteroids in the top rowdescends).If the game is over, then asteroids do not need to be replaced.Scoring #1 (Level 1 – 10 marks)(This assumes that you have implemented “Hit Detection” above.) Add a scoring method to theprogram so that 1 is added to the score each time a projectile hits an asteroid. You should makeuse of the function add_to_score(uint16_t value) declared in score.h. You should callthis function (with an appropriate argument) from any other function where you want to increasethe score. If a .c file does not already include score.h, you may need to #include it. You must alsoadd code to display the score (to the serial terminal in a fixed position) and update the score displayonly when it changes. The displayed score must be right-aligned – i.e. the right-most digit in thescore must be in a fixed position. (The score need not be on the right-hand edge of the terminaldisplay – it just must be right-aligned within a given field position – i.e. the least significant digitmust always be in the same location.) A score of 0 must be displayed when the game starts. Addappropriate text (e.g. “Score:”) to the terminal display so it is clear where the score is beingdisplayed. If game-over is possible (see functionality below) then the score must remain displayedon game-over (until a new game commences when the score should be reset).Scoring #2 (Level 1 – 10 marks)(Assumes that Scoring #1 is implemented.) Display the score on the seven-segment display. Thescore should start at 0. For scores from 0 to 9 inclusive the left seven segment digit should beblank. If scores greater than 99 are possible in your game then make a reasonable assumptionabout what should be displayed. (This is unlikely to be tested.) No display flickering should beapparent. Both digits (when displayed) should be of equal brightness.The score can be maintained on the seven-segment display when the game is over, or the displaycan be blanked. (Note that the score must remain displayed on the terminal display – as perScoring #1 above.)No “ghosting” should be evident, i.e. the value of one digit showing faintly on the other.Falling Asteroids (Level 2 – 6 marks)Add a feature so that the asteroids descend down the display (e.g. every half a second, all theasteroids are moved down by one position). Asteroids should be removed when they reach thebottom. Removed asteroids should be replaced by a new asteroid in the top row (in a randomcolumn not already occupied). You may need to vary the speed of projectiles to ensure a playablegame. The base station should always remain visible.Base Station Hit Detection (Level 2 – 6 marks)(Assumes that “Falling Asteroids” are implemented as well as “Scoring #1”.) Modify the programso that collisions between falling asteroids and the base station are detected (and the asteroidremoved) and some action is taken e.g. game over or score reduced or the number of lives isreduced (see below). (If you implement a score reduction rather than reducing the number of livesthen you must deal with the possibility of the current score being zero, e.g., “game over”.) Ongame-over, the score must remain displayed on the terminal display (at least) and the game mustbe able to be restarted by pushing a button on the IO board. If the game is not over upon a “hit”then the removed asteroid should be replaced at the top as described in “Falling Asteroids”.CSSE2010 / CSSE7201 Project, Semester 1, 2019 6Note that the base station moving into an asteroid should be treated the same as the asteroid hittingthe base station.Multiple Lives – Health Bar (Level 2 – 6 marks)(Requires that “Falling Asteroids” and “Base Station Hit Detection” are implemented.) Modifythe program to support multiple lives, i.e., a life is lost every time the base station is hit by anasteroid. There are four lives initially. If all lives are lost then the game is over (and the samegame-over requirement as described in “Base Station Hit Detection” applies). The number of livesremaining must be indicated using 4 LEDs as a “health bar” (L5, L4, L3 and L2 on the IO Board– which are green, red, orange and green respectively). When one life is lost, a green LED shouldbe switched off. When the second is lost, the other green LED is switched off. When the third islost, the orange LED is switched off (leaving only the red). When the last life is lost, all four LEDsshould be off. The number of lives remaining must also be shown on the terminal display. Notethat the connection to the 4 LEDs must be able to be made with a single 4-wire jumper cable from4 adjacent IO pins on the AVR microcontroller board.Acceleration (Level 2 – 6 marks)(Requires implementation of “Scoring #1” and “Falling Asteroids”.) Make the game speed up asthe score gets higher. This can be gradual or in steps (e.g. as certain scores are reached). (Do notspeed up play too quickly. An average player should be able to play your game for at least 90seconds, but the speed-up must be noticeable within 45 seconds.)Game Pause (Level 2 – 6 marks)Modify the program so that if the ‘p’ or ‘P’ key on the serial terminal is pressed then the gamewill pause. When the button is pressed again, the game recommences. (All other button/keypresses/inputs should be discarded whilst the game is paused – i.e. will not affect the movementof the base station or projectile firing when the game is unpaused.) The asteroid/projectilemovement rate must be unaffected – e.g. if the pause happens 450ms before an asteroid movementis due, then the asteroid should not move until 450ms after the game is resumed, not immediatelyupon resume. The check for this key press is implemented in the supplied code, but does nothing.EEPROM Storage of High Score Leader Board (Level 3 – 5 marks)Implement storage of a leader board (top 5 scores and associated names) in EEPROM so thatvalues are preserved when the power is off. If a player achieves a top-5 score then they should beprompted (via serial terminal) for their name. The score and name must be stored in EEPROMand must be displayed on the serial terminal on program startup and at each game-over – indecreasing order of score. If there are fewer than 5 high scores then only show those that havebeen saved so far. (You must handle the situation of the EEPROM initially containing data otherthan that written by your program. You will need to use a “signature” value to indicate whetheryour program has initialized the EEPROM for use.) Name entry must be resilient to arbitraryresponses (i.e. invalid characters / escape sequences / button presses etc. should not causeunexpected behaviour). The only characters supported must be letters, spaces and the backspace(Ctrl-H) and delete (Ctrl-? – ASCII 127) keys (with both of the latter having the effect of abackspace). Name entry is terminated by the return/enter key. Names up to 12 characters longmust be supported.Sound Effects (Level 3 – 5 marks)Add sound effects to the program which are to be output using the piezo buzzer. Different soundeffects (tones or combinations or tones) should be implemented for at least four events. (At leasttwo of these must be sequences of tones for full marks.) For example, choose four of: Base station moving Projectile being fired Projectile hitting asteroidCSSE2010 / CSSE7201 Project, Semester 1, 2019 7 Base station hit by asteroid game start-up constant background tuneDo not make the tones too annoying! Switch 7 on the IOboard must be used to toggle sound onand off (1 is on, 0 is off). You must specify which AVR pin this switch is connected to and whichAVR pin the piezo buzzer must be connected to. (The piezo buzzer will be connected from thereto ground.) Your feature summary form must indicate which events have different sound effects.Sounds must be tones (not clicks) in the range 20Hz to 5kHz. Sound effects must not interferewith game play, e.g. the speed of play should be the same whether sound effects are on or off.Sound must turn off if the game is paused.A “sequence of tones” can be just two tones long if desired (or can be longer).Joystick (Level 3 – 5 marks)Add support to use the joystick to move the base station left and right (by moving the joystick leftand right) and to fire projectiles (by moving the joystick up or down). This must include supportfor auto-repeat – if the joystick is held in one position then, after a short delay, the code shouldact as if the joystick was repeatedly moved in that direction. Your movement must be reasonable– e.g. do not immediately jump or appear to immediately jump to one side if the joystick is heldto that side. Your base station must be shown to move through all positions and be able to bestopped at that position if the joystick is released. Be sure to specify which AVR pins the U/D andL/R outputs on the joystick are connected to. Be aware that different joysticks may have differentmin/max/resting output voltages and you should allow for this in your implementation – your codewill be marked with a different joystick to the one you test with.Variable movement speed (where the speed of movement depends on the position of the joystick)is permissible but need not be implemented.It can be assumed that the joystick is in its resting position when the game is started.It is permissible to use the U/D joystick direction as moving the base station left/right, etc. (as thismay make more sense with the orientation of your joystick and display). Make sure this is notedon your feature summary form.Game Display on Terminal Screen (Level 3 – 5 marks)Display a copy of the LED matrix display on the serial terminal using block graphics andcharacters of various colours – possibly different colours to those used on the LED matrix. Thisshould allow the game to be played either by looking at the LED matrix or at the serial terminal.(The serial terminal display must keep up with the LED matrix display, i.e. must be no more thanabout 100ms behind the LED matrix display.) The baud rate must remain at 19200. You canassume that the terminal display will be at least 80 columns in width and 24 rows in height (i.e.the default size in PuTTY). You will need to draw an appropriate border to indicate the gamefield.The speed of game play must not be adversely affected by the presence of this feature.The orientation of the game display should match that in the figure on page 3 of this specification,i.e. the left cursor key moves the base station left, etc.Note that the number of asteroids in the game should not be altered from that in the supplied code(20).CSSE2010 / CSSE7201 Project, Semester 1, 2019 8Visual Effects on the LED display (Level 3 – 5 marks)Implement visual effects on the LED display – i.e. multi-pixel animations in response to at leasttwo events, e.g. an explosion effect when a projectile hits an asteroid. Select two of the followingevents: projectile hitting asteroid asteroid hitting base station game overChanging colours on existing game elements (e.g. base station) is not sufficient. The animationshould extend to pixels beyond those used for the game elements – but not interfere with thedisplay after the animation is finished. Note that scrolling a message on the display (e.g. on gameover) does not count as a multi-pixel animation. The two animations should be different – e.g. itis not appropriate to use the same explosion animation when a projectile hits an asteroid as is usedfor an asteroid hitting the base station.Visual effects do not need to be shown on the terminal display (but can be if desired).Variable Speed Asteroids (Level 3 – 5 marks)(Requires “Falling Asteroids”.) Implement asteroids which move at different speeds, i.e., somedescend faster than others (but each asteroid descends at a constant rate which is randomly chosenwhen the asteroid appears). It must not be possible for a faster asteroid to pass through a slowerone. If a faster asteroid (or group of asteroids) “catches up” with a slower one then it will slowdown to the speed of the asteroid ahead of it and occupy the position immediately behind it. Thisfunctionality must be able to be demonstrated in normal game play.If a limited fixed number of speeds is used (i.e. the random selection is from a small set of fixedspeed values as opposed to a random value in a wider number range) then there must be at leastthree different speeds evident.Asteroids must be shown to move through every pixel position – they should not jump two orthree pixels at a time.Although “constant rate” is specified here, it is acceptable for the speed to increase as a result ofyour “acceleration” functionality, e.g. as the score increases.Assessment of Program ImprovementsThe program improvements will be worth the number of marks shown above. You will be awardedmarks for each feature up to the maximum mark for that feature. Part marks will be awarded fora feature if only some part of the feature has been implemented or if there are bugs/problems withyour implementation (which may include issues such as incorrect data direction registers). Youradditions to the game must not negatively impact the playability or visual appearance of the game.Note also that the features you implement must appropriately work together, for example, if youimplement game pausing then sound effects should pause.Features are shown grouped in their levels of approximate difficulty (level 1, level 2, and level 3).Some degree of choice exists at level 3, but the number of marks to be awarded here is capped,i.e., you can’t gain more than 20 marks for advanced features even if you successfully add all thesuggested advanced features. You can’t receive more than 100 marks for the project as a whole.CSSE2010 / CSSE7201 Project, Semester 1, 2019 9Submission DetailsThe due date for the project is 7:50pm Friday 31 May 2019. The project must be submitted viaBlackboard. You must electronically submit a single .zip file containing ONLY the following:All of the C source files (.c and .h) necessary to build the project (including any that wereprovided to you – even if you haven’t changed them); Your final .hex file (suitable for downloading to the ATmega324A AVR microcontrollerprogram memory); and? A PDF feature summary form (see below).Do not submit .rar or other archive formats – the single file you submit must be a zip format file.All files must be at the top level within the zip file – do not use folders/directories or other zip/rarfiles inside the zip file.If you make more than one submission, each submission must be complete – the single zip filemust contain the feature summary form and the hex file and all source files needed to build yourwork. We will only mark your last submission and we will consider your submission time (forlate penalty purposes) to be the time of submission of your last submission.The feature summary form is on the last page of this document. A separate electronically-fillablePDF form will be provided to you also. This form can be used to specify which features you haveimplemented and how to connect the ATmega324A to peripherals so that your work can bemarked. If you have not specified that you have implemented a particular feature, we will not testfor it. Failure to submit the feature summary with your files may mean some of your features aremissed during marking (and we will NOT remark your submission). You can electronicallycomplete this form or you can print, complete and scan the form. Whichever method you choose,you must submit a PDF file with your other files.Assessment ProcessYour project will be assessed during the revision period (the week beginning Monday 3 June2019). You have the option of being present when this assessment is taking place, but whetheryou are present or not should not affect your mark (provided you have submitted an accuratefeature summary form). Arrangements for the assessment process will be publicised closer to thetime.Incomplete or Invalid CodeIf your submission is missing files (i.e. won’t compile and/or link due to missing files) then wewill substitute the original files as provided to you. No penalty will apply for this, but obviouslyno changes you made to missing files will be considered in marking.If your submission does not compile and/or link in Atmel Studio 7 for other reasons, then themarker will make reasonable attempts to get your code to compile and link by fixing a smallnumber of simple syntax errors and/or commenting out code which does not compile. A penaltyof between 10% and 50% of your mark will apply depending on the number of correctionsrequired. If it is not possible for the marker to get your submission to compile and/or link bythese methods then you will receive 0 for the project (and will have to resubmit if you wish tohave a chance of passing the course). A minimum 10% penalty will apply, even if only onecharacter needs to be fixed.CSSE2010 / CSSE7201 Project, Semester 1, 2019 10Compilation WarningsIf there are compilation warnings when building your code (in Atmel Studio 7, with defaultcompiler warning options) then a mark deduction will apply – 1 mark penalty per warning upto a maximum of 10 marks. To check for warnings, rebuild ALL of your source code (choose“Rebuild Solution” from the “Build” menu in Atmel Studio) and check for warnings in the “ErrorList” tab. Note that the code supplied to you has one compilation warning – theremove_asteroid() function in game.c is defined but not used. You should remove thisfunction if you do not use it in your submission to avoid this warning.Late SubmissionsLate submission will result in a penalty of 10% plus 10% per calendar day or part thereof,i.e. a submission less than one day late (i.e. submitted by 7:50pm Saturday 1 June, 2019) will bepenalised 20%, less than two days late 30% and so on. (The penalty is a percentage of the markyou earn (after any of the other penalties described above), not of the total available marks.)Requests for extensions should be made via the process described in the course profile (before thedue date) and be accompanied by documentary evidence of extenuating circumstances (e.g.medical certificate). The application of any late penalty will be based on your latest submissiontime.Notification of ResultsStudents will be notified of their results at the time of project marking (if they are present) or latervia Blackboard’s “My Grades”.The University of Queensland – School of Information Technology and Electrical EngineeringSemester 1, 2019 – CSSE2010 / CSSE7201 Project – Feature SummaryStudent Number Family Name Given NamesAn electronic version of this form will be provided. You must complete the form and include it (as a PDF) in yoursubmission. You must specify which IO devices you’ve used and how they are connected to your ATmega324A.Port Pin 7 Pin 6 Pin 5 Pin 4 Pin 3 Pin 2 Pin 1 Pin 0B SPI connection to LED matrix Button B3 Button B2 Button B1 Button B0(Anything you want the marker to consider or know?)Penalties: (code compilation, incorrect submission files, etc. Does not include late penalty)Final Mark: (excluding any late penalty which will be calculated separately)
因为专业,所以值得信赖。如有需要,请加QQ:99515681 或邮箱:
微信:codinghelp