1. 程式人生 > >代做C++程式設計作業、代寫geometric留學生作業、代做C++課程設計作業 代寫R語言程式|幫做C/C++程式設計

代做C++程式設計作業、代寫geometric留學生作業、代做C++課程設計作業 代寫R語言程式|幫做C/C++程式設計

Introduction In this assignment, you are going to develop the Ludo Game, a board game that runs in the command line environment. Ludo game is a board game for two to four players. The players race their four chesses from start (“Base”) to finish (“Home”) according to the rolls of a single die. The player who first moves all chesses to “Home” is the winner. Write a Win32 Console Application program called LudoGame.cpp. The requirements are listed below. System Requirements R0 When the program starts, the console should display a welcome message, and then the Game Menu of the program. User can enter the options of the corresponding actions (see R1 to R6 below). Welcome Message designed by your group *** Game Menu *** [1] Start Game [2] Settings [3] Game Demo [4] Instructions [5] Credits [6] Exit

Option (1 - 6): R1 [1] Start Game When the user inputs 1 in the Game Menu, the game starts with the current game settings (see R2). Each player has FOUR chesses. Names of the chesses for each player are listed in the table below. Player 1 Player 2 Player 3 Player 4 a b c d e f g h i j k l m n o p Initially, all chesses are at their starting location “Base”. By rolling a die (i.e., generating a random number from 1 to 6) and according to the rules of the game (see R1.3), the player can race the chesses to the finishing location “Home”. R1.1 Game board The players play on a square game board, with ‘.’ showing the board positions and ‘X’ showing the “Home” location. When the game begins, the game board together with each player’s chess information should be displayed. In the example below, there are two players. Player 1 is the human player whereas Player 2 is the computer player. . . . . . . . . . . . . . . . . . . . . . . . . . . . . X . . . . . . . . . . . . . . . . . . . . . . . . . . . . Player 1: Human Base: a b c d Home: Player 2: COMP Base: e f g h Home: R1.2 Moving paths Chess Information for each player When a chess leaves its “Base”, it enters the game board and stops at the first position, which is different for each player: Player 1 Player 2 Player 3 Player 4 Top-left corner Top-right corner Bottom-right corner Bottom-left corner For each player, the moving paths for the chess to complete are shown below. Note that after a chess leaves its “Base”, it needs to move 45 steps to reach ‘X’, i.e., “Home”. Player 1 Player 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X . . X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Player 3 Player 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X . . X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . R1.3 Game rules • To have a chess leaving “Base” and entering the game board, a player must roll ‘6’. If the player has no chess on the game board and fails to roll ‘6’, the turn passes to the next player. • If a player has one or more chess to move, he chooses a movable chess from the given list and moves the chess along the path by the number of positions according to the rolling result. • If a player rolls a ‘6’, he gets a bonus turn. If the bonus turn rolls a ‘6’ again, he gets one more bonus turn. If he rolls a ‘6’ once again, there is no more bonus turn; after his move the turn passes to the next player. • A player cannot move a chess into a location that is occupied by other chesses of that player. • If a chess ends on a position occupied by an opponent’s chess, the opponent chess is sent back to the opponent’s “Base”. Any chess that has reached “Home” should be “safe” from being sent back. • A chess can reaches “Home” only if it exactly steps on ‘X’. If the rolling value exceeds the number of steps required, the chess should move backward for the remaining steps. R1.4 Human and Computer Player There can be 2 to 4 players to play the game. Players can be human players or computer players. A human player will select which chess to move among the movable chesses, whereas a computer player will choose one of the movable chesses randomly. Choice made by the computer should be displayed clearly on the console screen. When the program begins, the game is played by two players, one human and one computer player, as the default setting. R1.5 Game play – Players take turns Each player takes turn (starting from Player 1 to Player 4) to roll a die to get a number from 1 to 6. Based on the game rules (see R1.3), the system shows a list of movable chesses according to the rolling result. The player then can choose a movable chess to move on the game board according to the moving path of the player (see R1.2). R1.6 Game play – Command “q” Player can input ‘q’ to quit the game at any time during the game when he is asked to choose a movable chess. If this happens, the system should prompts for player’s confirmation. If the player inputs ‘y’ or ‘Y’, the game ends and the system returns to the Game Menu. If the player inputs ‘n’ or ‘N’, the game continues at its current status. Other input is not acceptable and the system should ask the player to confirm again. R1.7 Game Play – Game ends The game finishes when there is a winner, who moved all four chesses to “Home”, i.e., ‘X’ on the game board. If the game finishes, the system should display who is the winner, and the program returns back to the Game Menu. R2 [2] Settings When the user inputs 2 in the Game Menu, the console displays the Settings Menu. User can enter the options of the corresponding actions (see R2.1 to R2.3 below). *** Settings Menu *** [1] Number of players [2] Number of human players [3] Return to Game Menu

Option (1 - 3): R2.1 [1] Number of players When the user inputs 1 in the Settings Menu, the console displays the current game setting of how many players play the game, and prompts for the user input of the new setting. Note that acceptable number of players is from 2 to 4 only, and should not be less than the current number of human players. After the setting is updated, the new setting should be displayed and the system returns back to the Settings Menu. R2.2 [2] Number of human players When the user inputs 2 in the Settings Menu, the console displays the current game setting of how many human players play the game, and prompts for the user input of the new setting. Note that acceptable number of human players is 0 to the number of players of the game. After the setting is updated, the new setting should be displayed and the system returns back to the Settings Menu. R2.3 [3] Return to Game Menu When the user inputs 3 in the Settings Menu, the system returns back to the Game Menu. R3 [3] Game Demo When the user inputs 3 in the Game Menu, the console displays the Demo Menu. User can enter the options of the corresponding actions (see R3.1 to R3.4 below). **** Demo Menu ***** [1] Three consecutive ‘6’ [2] Chess touches home and reverses, reaches home and wins [3] Chess does not self-overlap, and sends back opponent chess [4] Return to Game Menu

Option (1 - 4): Under the Game Demo options, a game is played by two computer players. By presetting the positions of chesses for the players and the rolling results (both to be designed by yourself), you are required to show the required scenarios (see R3.1 to R3.3 below) within 5 turns of plays by the players, after an option 1 to 3 is entered. R3.1 [1] Three consecutive ‘6’ To design and show a scenario that a player gets three consecutive ‘6’ during a game. R3.2 [2] Chess touches home and reverses, reaches home and wins To design and show a scenario that a player moves the last chess that touches “Home” and goes backward, because the rolling value exceeds the number of steps required to step on “Home”. Finally, this player can move the chess home and win the game. R3.3 [3] Chess does not self-overlap, and sends back opponent chess To design and show a scenario that a player cannot move a chess into a location that is occupied by other chesses of that player. Afterwards, the player’s chess ends on a position occupied by an opponent’s chess, causing the opponent chess to be sent back to the opponent’s “Base”. R3.4 [4] Return to Game Menu When the user inputs 4 in the Demo Menu, the system returns back to the Game Menu. The previously used game setting (i.e., number of players and number of human players) will be restored. R4 [4] Instructions The system displays the instructions for playing the Ludo game. After displaying the instruction, the system returns back to the Game Menu. R5 [5] Credits The system displays the personal particulars (e.g. student name, student ID, class, tutorial group, etc.) of the group members. After displaying the information, the system returns back to the Game Menu. R6 [6] Exit When the user inputs this option, the system prompts for user’s confirmation. If the user inputs ‘y’ or ‘Y’, the program terminates. If the user inputs ‘n’ or ‘N’, the system returns to the Game Menu. Other input is not acceptable and the system should ask the user to confirm again. Other General Requirements R7 Meaningful guidelines should be printed to assist with user’s input. Whenever an option is selected, meaningful messages should be displayed. R8 Suitable checking on user’s input is expected. Appropriate error messages should be printed whenever unexpected situation happens, e.g., invalid input, input out-of-range, etc. R9 The use of functions (in addition to main function) and classes are expected in your program. Appropriate comments should be added in your source code file. R10 Creativity and Critical Thinking: other features that you find useful (such as the “intelligence of computer player”) or can enhance the user experience can also be implemented. Grading criteria Aspects Percentage Program correctness (Follow ALL instructions, marks deduction on errors found) 70% Program design (Appropriate use of functions, use of class, modularity, etc.) 10% Program standard (Use of variable names, indentation, line spacing, clarity, comments, etc.) 5% Algorithm design (Use of reasonable algorithms and data structures) 5% User-friendliness (Clear guidelines to users, messages to users, etc.) 5% Creativity and critical thinking (Additional useful features) 5% Total (Group Mark) 100% (max) Note: the length of your program does not affect the grading of the assignment. However, appropriate use of loops and functions are expected to avoid too many repeated codes in your program, which contributes to the program design score of this assignment. Individual mark is determined by both group mark (80%) and individual contribution (20%), where individual contribution is directly proportion to the average marks given by group members in the peer-to-peer evaluation form. Marks deduction Marks will be deducted if the program fails to be compiled. The deduction is from 5 to 20 marks, depending on how serious the syntax error is. Note that if the program contains unacceptably too many serious syntax errors, your program will score 0 marks. Syntax errors also lead to failure in the program correctness if the function cannot be tested. So please make sure that your program can be compiled successfully before your submission. Tips To refresh the console screen, you may use the following windows platform command appropriately in your program by adding the header file : system(“cls”); // Clear everything on the screen system(“pause”); // Wait until user pressing any key to continue To handle unexpected input error (e.g. input a character to an integer variable), you may use the following code appropriately in your program: cin.ignore(); // Discard the content in the input sequence cin.clear(); // Reset the input error status to no error