辅导COSC1076编程语言、 写作C++程序设计

” 辅导COSC1076编程语言、 写作C++程序设计Advanced Programming TechniquesCOSC1076 | Semester 1 2021Assignment 2 | Implementing QwirkleAssessment Type Assessment contain both group (Milestones 1 2) and individual (Milestone3 4) components. Clarifications/updates may be made via announcements/relevantdiscussion forums.Due Date Milestones 1 2 11.59pm, Friday 14 May 2021Due Date Milestones 3 4 11.59pm, Friday 28 May 2021Silence Policy From 5.00pm, Thursday 27 May 2021Weight 45% of the final Course markSubmission Online via Canvas. Submission instructions are provided on Canvas.1Contents1 Introduction 31.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 Group Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.3 Learning Outcomes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Base Program Game play Functionality 42.1 Launch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2 Main Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.3 Base Gameplay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.4 User Prompt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.5 Rule Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Deliverables 123.1 Mandatory Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2 Milestone 1: Test Cases (Group Component) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.3 Milestone 2: Basic Qwirkle Implementation (Group Component) . . . . . . . . . . . . . . . . . . 133.4 Milestone 3: Enhancements (Individual Component) . . . . . . . . . . . . . . . . . . . . . . . . . 143.5 Milestone 4: Written report Demonstration (Group + individual Component) . . . . . . . . . 144 Suggested Enhancements for Milestone 3 164.1 Minor enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164.2 Major enhancements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164.3 Milestone 2 Code with Significant Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 Managing Group Work 175.1 Group Work Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175.2 Suggested Weekly Schedule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.3 Group Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185.4 Notifying of Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 Getting Started 186.1 Designing your Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186.2 Starter Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 Submission 197.1 Silence Period . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197.2 Late Submissions, Extensions Special Consideration . . . . . . . . . . . . . . . . . . . . . . . . 197.3 Group Work Penalties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 Marking guidelines 199 Academic integrity and plagiarism (standard warning) 1921 Introduction1.1 OverviewIn this assignment you will implement a 2-player text-based version of the Board Game Qwirkle.(a) Qwirle box and pieces (b) Example game stateFor an explanation of the Rules and gameplay: TableTop rules explanation of full game: httpss://youtu.be/Hp3IwPbZYSE?t=60 Rules: Available on Canvas ( httpss://www.ultraboardgames.com/qwirkle/game-rules.php).However, this assignment will use a modified version of the rules, detailed in Section 2.5.In this assignment you will: Practice the programming skills covered throughout this course, such as: ADTs Linked Lists Pointers Dynamic Memory Management File Processing Program State Management Exception Handling Practice the use of testing Implement a medium size C++ program: Use features of C++14 Use elements of the C++ STL Work as a team Use group collaboration toolsThis assignment is divided into four Milestones: Milestone 1 (Group work): Test Cases, to be developed to ensure your Qwirkle implementation iscorrect. Milestone 2 (Group work): A fully functioning implementation of the base Qwirkle game play, whichpass Milestone 1 tests. The group work (milestone 1 2) is worth 30% of the course mark. The groupcomponent (M1 M2) is due 11.59pm, Friday 14 May 2021(Week 10). Milestone 3 (Individual work): You will individually extend upon your groups implementation withadditional functionality (called enhancements). The individual work is worth 15% of the course mark.The individual Component (M3) is due 11.59pm, Friday 28 May 2021(Week 12). Milestone 4: Written report demostration. The report analysing the design and implementation ofyour software, and the use of your test cases. You will demonstrate your group and individual work. Thisis where your final work will be graded. The report is due 11.59pm, Friday 28 May 2021(Week 12).Group Progress Update (Group work): Your group will provide regular updates on your progress in thisassignment to your tutor during your weekly lab classes. This will require your group to have completed a listof activities. Group Progress Update will not be marked directly, however, this will influence the final grade.31.2 Group WorkThe group work must be completed in groups of 4.1. You may form groups with any student in the course.2. We strongly recommend that you form groups from within your labs, because: Your tutor will help you form groups,but only within your lab. You will have plenty of opportunity to discuss your groups progress and get help from your tutorduring the rest of the course. It will be extremely helpful for your whole group to be present, butthis cant happen if you have group members outside the lab.Groups for Assignment 2 must be registered with your tutor by week 8 lab1. Your tutor register yourgroup on Canvas. If you are unable to find a group, discuss this with your tutor as soon as possible.If at any point you have problems working with your group, inform your tutor immediately, so that issues maybe resolved. This is especially important with the online delivery of the course. We will do our best to helpmanage group issues, so that everybody receives a fair grade for their contributions. To help with managingyour group work we will be requiring your group to use particular tools. These are detailed in Section 5.There are important requirements about keeping your tutor informed if you have been unwell orother wise unable to contribute to your group. Remember your actions affect everybody in yourgroup.1.3 Learning OutcomesThis assessment relates to all of the learning outcomes of the course which are: Analyse and Solve computing problems; Design and Develop suitable algorithmic solutions using softwareconcepts and skills both (a) introduced in this course, and (b) taught in pre-requisite courses; Implementand Code the algorithmic solutions in the C++ programming language. Discuss and Analyse software design and development strategies; Make and Justify choices in softwaredesign and development; Explore underpinning concepts as related to both theoretical and practicalapplications of Software design and development using advanced programming techniques. Discuss, Analyse, and Use appropriate strategies to develop error-free software including static code analysis,modern debugging skills and practices, and C++ debugging tools. Implement small to medium software programs of varying complexity; Demonstrate and Adhere to goodprogramming style, and modern standards and practices; Appropriately Use typical features of the C++language include basic language constructs, abstract data types, encapsulation and polymorphism, dynamicmemory management, dynamic data structures, file management, and managing large projectscontaining multiple source files; Adhere to the C++14 ISO language features. Demonstrate and Adhere to the standards and practice of Professionalism and Ethics, such as describedin the ACS Core Body of Knowledge (CBOK) for ICT Professionals.2 Base Program Game play FunctionalityThe base Qwirkle program implements a 2-player text-based version of Qwirkle, using a reduced rule-set. Inthe base game, the players take turns placing tiles from their hand onto the board. The rule changes for thebase Qwirkle game are described in Section 2.5.This section details the behaviour of the base Qwirkle program. What is presented in this spec is a descriptionof the main functionality of your Qwirkle program. Some parts are left open for you to decide the best courseof action.This spec does not give the rules of Qwirkle. Canvas contains a link to the rules.!Aspects of this specification are flexible and open to your interpretation. In general, where there isflexibility, it is up to you to determine the best course of action. You may ask questions on the forumfor clarity. Make sure that your tests are written to ensure your program works correctly based on anydecisions you make.2.1 LaunchYour base Qwirkle program will be run using the following terminal command:1If your group spans multiple labs, have one of your tutors register the group.4$ ./qwirkleOn launch, the program should display a welcome message:Welcome to Qwirkle!——————-Following the welcome message, the program should continue to the main menu.2.2 Main MenuThe main menu shows The options of your Qwirkle program. By default there should be 4 options. The menuis followed by the user prompt.Menu—-1. New Game2. Load Game3. Credits (Show student information)4. QuitThe user selects an option by typing a number, and pressing enter. Each menu option is described below. Theuser prompt is described in Section 2.4, including what to do for invalid input.2.2.1 New GameThe program should:1. Print a message for starting a new game2. Ask for the player names3. Create a new game of Qwirkle,4. Proceed with normal gameplay.As an overview, this process may look like: 1Starting a New GameEnter a name for player 1 (uppercase characters only) user enters nameEnter a name for player 2 (uppercase characters only) user enters nameLets Play!normal gameplay Continues from hereThe players should only consist of letters (no numbers or symbols). Your program should validate (check) thatthe player name is valid.The Qwirkle gameplay is described in Section 2.3. Make sure you take note of the requirements for starting anew game, described in Section 2.3.10.2.2.2 Load GameThe program should first ask the user for a filename from which to load a game.5 2Enter the filename from which load a gameThe user enters the relative path to the saved game file, and presses enter.After the filename is provided, the program must then conduct two validation checks:1. Check that the file exists.2. Check that the format of the file is correct. The format for saved games is described in Section 2.3.7.If the filename passes both checks, the program should print a message, then load the game as described inSection 2.3.12, and continue with normal gameplay as described in Section 2.3. filenameQwirkle game successfully loadedgame play continues from here2.2.3 Credits (Show student information)The program should print the name, student number, and email address of each student in the group, separatedby new lines. Note that you should replace full name, student number and email address sectionswith your full name, student number and student email address.After printing the student details, the program should return to the main menu. 3———————————-Name: full nameStudent ID: student NumberEmail: email addressName: full nameStudent ID: student numberEmail: email addressStudent 3, etc.———————————-main menu2.2.4 QuitThe program should print a goodbye message, and safely terminate without crashing. 4Goodbye2.3 Base GameplayDuring base Qwirkle gameplay, the 2 players take turns placing tiles from their hand onto the board.At the start of the players turn, the program should show (in order):1. The name of the current player2. The scores of both players3. The state of the board64. The tiles in the current players hand5. The user promptThe current player may then take one of two actions:1. Place a tile onto the board2. Replace on tile in their handOnce the player successfully takes their action, their turn ends, and the other players turn starts.Alternatively, the player may perform one of two game functions:1. Save the game to a file2. Quit the gameBelow is an example of a Sequence of actions and game functions for two players, named A and B. The nextsub-sections, describe the individual aspects of the base gameplay. previous output A, its your turnScore for A: 6Score for B: 60 1 2 3 4 5——————-A | | | | | | |B | | |B4|B6|B5| |C | | |R4| | | |D | |Y1|Y4|Y2| | |E | | |P4| | | |F | | | | | | |Your hand isY5,G5,R5,O2,B1,P6 place G5 at C4B, its your turnScore for A: 8Score for B: 60 1 2 3 4 5——————-A | | | | | | |B | | |B4|B6|B5| |C | | |R4| |G5| |D | |Y1|Y4|Y2| | |E | | |P4| | | |F | | | | | | |Your hand isP2,P3,O6,G1,Y4,B2 replace G1 gameplay continues 2.3.1 Tile CodesTiles are represented by a 2-character code:colourshapeTo make it easier to visually differentiate tiles, colours are represented by letters, and shapes are representedby integers. The Codes are given in the table below7Colour Colour Code Shape Shape CodeRed R Circle 1Orange O 4-Star 2Yellow Y Diamond 3Green G Square 4Blue B 6-Star 5Purple P Clover 6For example, the Yellow Square tile is represented by the code: Y4!The Start-up code provides useful #define statements for these codes.2.3.2 The BoardThe display of the game board consists of two features:1. Tile Display2. Grid Co-ordinatesThe board is a 2D grid of tiles, up to a maximum size of 26×26. However, some locations of the 2D grid maybe empty, meaning that no tile has been placed there. When the board is displayed, all locations that containa tile are filled with the tile code, and empty locations filled with two-spaces.!The examples is this spec use an expandable board (see the Minor Enhancements in Section 4.1). That is,the board is only as large enough as necessary, and expands as the players add tiles.For the base game-play you may use a fixed size board.The grid co-ordinates use: Uppercase Letters for rows Integers for columnsBoard locations are always referenced in row-column fashion:rowcolumnFor example, the blue square is at grid co-ordinate B2, and the yellow circle is at grid co-ordinate D1.0 1 2 3 4 5——————-A | | | | | | |B | | |B4|B6|B5| |C | | |R4| | | |D | |Y1|Y4|Y2| | |E | | |P4| | | |F | | | | | | |You could store the board as A vector of vectors of Tiles!In your Implementation you must use a vector to store the board.2.3.3 The Players HandThe players hand is an ordered linked list of tiles.!In your implementation you must use a linked list to store the tiles in the players hand. You mustimplement your own version of a Linked List.The players hand is displayed as a comma separated list of tiles.Your hand isY5,G5,R5,O2,B1,P6The order of tiles in the players hand is important for testing purposes!8 When adding a tile, it is always added at the end of the list. When removing a tile, the remaining tiles stay in the same order.2.3.4 The Tile BagThe tile bag, contains the rest of the tiles that are not on the board or in players hands. The tile bag mustbe stored as an ordered linked list. The contents of the tile bag is never displayed to the users. However, thecontents of the tile bag is stored in the saved game file.!In your implementation you must use a linked list to store the tiles in the tile bag. You must implementyour own version of a Linked List.The order of the tile bag is determined when Generating a new game. When a tile is drawn from the bag, it istaken from the front of the linked list. If tiles are added to the bag, they are added to the end of the linked list.2.3.5 Player Action: Place a TileThe current player may place a tile onto the board using the command:place tile at grid locationThe command contains two elements:1. A tile to place2. The grid location to place the tileFor example, using the above Hand and board, if the player performs: place G5 at C4This results in the board:0 1 2 3 4 5——————-A | | | | | | |B | | |B4|B6|B5| |C | | |R4| |G5| |D | |Y1|Y4|Y2| | |E | | |P4| | | |F | | | | | | |After the command is given, the program must:1. Check that the command is correctly formatted.2. Check that the placement of tile is legal according to the rules of Qwirkle.If the players action is legal, the program should:1. Place the tile onto the board2. Update the players score3. Draw a replacement tile from the tile bag and add it to the players hand, if there are available tiles4. Continue with the other players turn2.3.6 Player Action: Replace a TileThe current player may replace one tile in their hand using the command:replace tileFor example, using the above hand the player may take the following replace action: replace P6After the command is given, the program must:1. Check that the Command is correctly formatted.92. Check that the tile is in the players hand.If the players action is legal, the program should:1. Remove the tile from the players hand and place it in the tile bag. (If the player has two tiles with thesame code, the first tile in the list should be replaced)2. Draw a new tile from the tile bag and add it to the players hand3. Continue with the other players turn2.3.7 Function: Saving the GameThe current player may save the game to a file using the command:save filenameThe program should save the current state of the game to the provided filename (overwriting the file if it alreadyexists). Then the program should display a message and continue with the gameplay. The current player doesnot change, so that a player may save the game and then take a turn. save savedGameGame successfully savedIf the program has problems saving the file, it should display a message, and continue with normal gameplaywithout crashing.The format of the saved file is as given below. Each item is saved on a new line.player 1 nameplayer 1 scoreplayer 1 handplayer 2 nameplayer 2 scoreplayer 2 handCurrent board shapeBoard Statetile bag contentscurrent player nameThe format for each of the items is: Name: ASCII text Score: Integer Player hand and tile bag: comma separated ordered list Current board shape: Height, width Board State: All tiles currently placed on the board should appear as a list of tile@position.For example, if the Game in Section 2.3 was saved the saved game file will look like:A8Y5,R5,O2,B1,P6,Y3B6P2,P3,O6,Y4,B2,O36,6B4@B2, B6@B3, B5@B4, R4@C2, G5@C4, Y1@D1, Y4@D2, Y2@D3, P4@E2P2,B5,…..A102.3.8 Function: QuitThe program should quit without crashing, as per the instructions in Section 2.2.4.2.3.9 Special Operation: QWIRKLE!If the player scores a Qwirkle (see the game rules) on their turn, then the program should print out an additionalmessage, before displaying the game information. Remember to update the players score accordingly. place .. at ..QWIRKLE!!!display game2.3.10 Special Operation: Starting a New GameWhen a new game is started, a special sequence of operations must be conducted:1. Create the ordering for the tile bag2. Set up the initial player hands3. Start with an empty board, with player 1 as the starting playerYou will need to devise your own algorithm to shuffle the bag of tiles to create a random initial order. Thisis left up to your own invention. The lectures will talk about randomness is C++ programs.Then the initial tiles are added to the players hands. 6 tiles are drawn from the tile bag and placed in the 1stplayers hand. Then 6 tiles are drawn from the tile bag and placed in the 2nd players hand.Finally, the board starts with no tiles placed, so that when displayed, it should be empty.2.3.11 Special Operation: Ending a GameThe game ends when:1. The tile bag is empty, and2. One player has no more tiles in their handIf the game ends, the program should: Display the end game message Display the Scores Display the name of the winning player Then quit, according to Section 2.2.4.For example:Game overScore for player 1 name: 000Score for player 2 name: 000Player winniner player name won!Goodbye2.3.12 Special Operation: Loading a GameTo load a game from a saved game file, the program should read the contents of the saved game file, and updateall data structures in the program using the information in the saved game file. See Section 2.3.7 for the formatof the saved game file. Specifically, the program should take note of: The players name and scores The tiles in each players hand The state of the board11 The order of the tiles in the tile bag The current player – the next player to take a turnOnce the game has been loaded, gameplay continues resumes with the current player.2.4 User PromptThe user prompt is displayed whenever input is required from the user. It is a greater-than symbol (), followedby a space. It is assumed that all user inputs are provided as a single line of input.When shown the prompt, the user should see in their terminal window: vIf at any point the user enters invalid input, or the validation checks of the input fail (see each section) thenthe program should print Invalid Input and re-show the prompt. qwertyInvalid Input v2.4.1 EOF CharacterIf an any time the user enters the EOF (end-of-file) character, the the program should Quit, following theprocedure in Section 2.2.4. That is: ^DGoodbyeThis behaviour with the EOF character is necessary to ensure your program terminates at the end of every testcase.2.5 Rule ChangesFor the base Qwirkle implementation, the following rules have been modified: A New game always begins with Player 1 and an empty board Tiles are placed one at a time. Players can only replace one tile at a time Maximum board size of 26×26 There are Only 2 tiles of each type (rather than 3 of each type). This makes it highly likely the game willfit within the 26×26 board, and reduce the complexity of your test cases. The modified game will have 72blocks, in 6 colors and with 6 different shapes and 2 of each type.For your Milestone 3 enhancements, you may restore some or all of these rules to their original form.3 Deliverables3.1 Mandatory RequirementsAs part of your implementation, you must: Implement your own Linked List Use your Linked List implementation to store the players hands and the tile bag. You should use vectors to store the current board state. You may only use the C++14 STL. You may not incorporate any additional libraries.If you fail to comply with these mandatory requirements, marks will be deducted.123.2 Milestone 1: Test Cases (Group Component)For Milestone 1, you must develop test cases for your Qwirkle implementation, including your enhancements.These test cases will help ensure that your Qwirkle implementation is correct.A single test case consists of 4 files, 2 mandatory and 2 optional.1. testname.input – Input to provide to the Qwirkle program via stdin2. testname.output – Expected output from the Qwirkle program on stdout3. (Optional) testname.save – Input save file to provide to the Qwirkle program if required by the test.4. (Optional) testname.expsave – Expected output saved game file.A test is run using the following sequence of commands../qwirkle testname.input testname.gameoutdiff -w testname.output testname.gameoutif [-e testname.expsave] diff -w -y testname.expsave actual_gamesaveIf this command displays any output, then the test has failed. Testing uses the diff command. Thiscommand checks to see if two files have any differences. The -w options ignores any white-space.To make testing reliable, you should note if the test evaluates the saved game output, then ensure the test usesa suitable filename in place of actual_gamesave.!The Qwirkle program has some degree of randomness due to the random ordering of the tile bag. Toovercome this issue When testing, when appropriate, you may start your test with loading a saved game(will contain the ordering of the tile bag, hence the execution from that point is deterministic).3.3 Milestone 2: Basic Qwirkle Implementation (Group Component)For Milestone 2, your group must implemented the base Qwirkle program as described in Section 2.Section 2 lists the components that your group must implement. Generally, it is up to your group to decide thebest way to implement these components. However, there are some important requirements that your groupmust satisfy.Aspects of this specification are flexible and open to your interpretation. It is up to your group to determine thebest course of action. You will need to analyse and justify your choices in the report.3.3.1 RequirementsYour group will implement a game of Qwirkle that: Is a 2-player game. Both players are human users that play the game by interacting with the terminal, that is, throughstandard input/output. Using the Qwirkle board of fixed size.You will implement a simplified version of Qwirkle. These changes are listed in section 2.5.Your implementation should provide the following functionality: A main menu, that allows users to perform actions such as setting up a new game, loading an existinggame, showing credits (details of the people who wrote the software), and quitting the program. Save a game to a file. Load a previously saved game from a file, and resume game play from the saved state. A way to represent and display the Qwirkle board and player hands the user. A User prompt for entering all commands from standard input. Base gameplay functionality as described in Section 2.3. The program should terminate without crashing if the EOF character is given on standard input. Completely error free. Your program must not crash, segfault or otherwise contain logic errors.Your group will also need to consider the data structures that are used to represent aspects of Qwirkle, andfunctionality. It is up to your group to make this decision provided that you meet the requirements in section3.1. In your report your group will be marked on your analysis of the above choices.Finally, remember to do the the group contribution spreadsheet described in 5.3″

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导