C Programming (Very Basic) Project Making The Bo Bing Chinese Game

Posted Under: C

Ask A Question
DESCRIPTION
Posted
Modified
Viewed 12
Very basic C programming homework. Everything required is included in the file. All the parameters at the bottom of the file should be followed, as well as the use of the rand() function.

This order does not have tags, yet.

Attachments
CCPROG1 Machine Project Term 1, AY 2020 – 2021 1 Introduction Every Mid-Autumn Season in the lunar calendar, it has been a Chinese-Filipino tradition that friends and family get together to celebrate the season and play the Dice Game. The rules of the dice game are fairly simple – Each player gets to roll 6 dice during their turn and based on the results of the roll, a player gets to pick a gift based on the category their roll falls into. The turn goes back to the first player once the last player has rolled and the sequence is repeated. The game ends when there is a 1st prize roller and all gifts from 2nd to 6th prize category have been claimed. Rules of the Game Roll Categories The ff. are the roll categories: Prize Category Philippine Hokkien Dice Combination 6th Prize It-siu 1 in the combination 5th Prize Di-ku 2 in the combination 4th Prize Si-Jin 4 of a kind except 3rd Prize Sam-Hong 3 in the combination 2nd Prize Tui-Teng 1,2,3,4,5,6 1st Prize – Level 2 Tsiong-Wan Tai <Kicker> 4 in the roll with 2 kicker dice 1st Prize – Level 1 Ngo-Tsi Tai <Kicker> 5 of a kind with 1 kicker die Embargo Tsiang 6 of a kind • If a roll does not fall in any of the combinations, then that player doesn’t get to pick a gift (e.g. 1,2,3,5,6,6). • If a roll falls into 2 or more categories, then the highest prize is followed (e.g. Combination of 5,5,5,5,5,4 wherein it falls under Ngo-Tsi and It-Siu then this roll is categorized as Ngo-Tsi since it is the higher prize category). • If there are 2 or more 1st prize winners, the one with the highest combination wins the game. • If there are more than 1 Tsiong-Wan winners, the one with the higher kicker (Tai) dice wins or the player of the latest roll wins if kickers are tied • If there are more than 1 Ngo-Tsi winners, the one with the higher kicker (Tai) dice wins or the player of the latest roll wins if kickers are tied • If a player happens to get a Tsiang roll, then that player immediately wins the game and claims all the remaining prizes in the table including the 1st prize Roll Category Variations Depending on the rules per family, combinations for Tsiong-Wan and Tui-Teng may vary as follows: CCPROG1 Machine Project Term 1, AY 2020 – 2021 2 Tsiong-Wan Tsah Kim Hweh (Tsiong Wan Level 2) (Golden Flower Tsiong Wan) 4-4-4-4-1-1 is the highest combination in the Tsiong-Wan Category outplaying 4-4-4-4-6-6 combination despite the latter’s kicker dice (Tai 12) is higher than the former’s kicker dice (Tai 2). Tui-Teng aside from 1,2,3,4,5,6 some family considers half-and-half (eg. 1-1-1-2-2-2) combination as Tui-Teng. These variations are declared before the start of the game. Prize Claiming A player immediately gets to pick a prize if their roll falls into one of the categories except if they rolled Tsiong-Wan or Ngo-Tsi (1st Prize Category). The number of prizes per category are as follows: Prize Category Philippine Hokkien Gift Count 6th Prize It-siu 32 5th Prize Di-ku 16 4th Prize Si-Jin 8 3rd Prize Sam-Hong 4 2nd Prize Tui-Teng 2 *1st Prize – Level 2 Tsiong-Wan Tai <Kicker> 1 *1st Prize – Level 1 Ngo-Tsi Tai <Kicker> Embargo Tsiang 1st Prize + whatever is left on the table If there are no more prizes in the category, then the player also does not get to claim a prize. * Tsiong-Wan Tai <Kicker> and Ngo-Tsi Tai <Kicker> are both getting the same first prize. If in the game, there are Tsiong-Wan Tai <Kicker> and Ngo-Tsi Tai <Kicker> rolls, Ngo-Tsi Tai <Kicker> roller gets the first prize since Ngo-Tsi Tai <Kicker> is higher than any Tsiong-Wan Tai <Kicker> roll even with the Golden Flower Tsiong Wan. End Game / Winner The game end when there is a 1st Prize winner and all the prizes have been claimed. Technical Requirements Number of Players At the start of the program, it should ask for the number of players. There is no need to ask for the names of the player, assume that the actual players will be assigned a number, and the players will be called based on that number. Sample Screen Output: How many players are there? 4 CCPROG1 Machine Project Term 1, AY 2020 – 2021 3 Special Rules / Rules Variation Once the number of players has been specified, the program should ask if the rules of the game will follow the Golder Flower Tsiong Wan and the half-and-half Tui Teng. If so, then the program should take these rules into consideration for the duration of the game. Sample Screen Output: Will the Golder Flower Tsiong Wan Rule be observed(y/n)? y Will the half-and-half Tui Teng be observed(y/n)? y Display Remaining Prizes, Highest 1st Prize and Rolling the Dice Your program should inform whose turn it is and ask them to roll the dice by pressing any key in the keyboard. To add excitement to the game, your program should display the remaining prizes left and the highest 1st prize roll if there are any. This information should always be updated accordingly. Sample Screen Output (no 1st prize): There are still: 6th prize: 31 5th prize: 16 4th prize: 7 3rd prize: 4 2nd prize: 1 1st prize: None Player 4 it is your turn. Please roll the dice by pressing any key. Sample Screen Output (with 1st prize): There are still: 6th prize: 31 5th prize: 16 4th prize: 7 3rd prize: 4 2nd prize: 1 1st prize: Ngo Tsi Tai 3 by Player 4 Player 1 it is your turn. Please roll the dice by pressing any key. CCPROG1 Machine Project Term 1, AY 2020 – 2021 4 Determine the Prize Category Once the dice have been rolled, the program should be able to inform the player which category he got if the roll falls into any or none if otherwise. Additionally, for 6th to 2nd prizes, the program should inform the player if he there are still any remaining prizes. For the 1st prize roll, the program should inform the player if he got the higher roll than the existing one. Sample Screen Output (3rd prize category with gift left): You rolled: 1 1 4 4 4 2 You got Sam-Hong. There are still 4 gifts left. Press any key to proceed to the next player. Sample Screen Output (3rd prize category with no gift left): You rolled: 4 2 6 4 1 4 You got Sam-Hong. There are no gifts left. Press any key to proceed to the next player. Sample Screen Output (no prize category): You rolled: 1 1 2 2 3 3 No prize. Press any key to proceed to the next player. Sample Screen Output (1st prize category, higher than current 1st prize): You rolled: 4 4 4 4 2 3 You got Tsiong Wan Tai 5. You are the highest 1st prize. Press any key to proceed to the next player. Sample Screen Output (1st prize category, lower than current 1st prize): You rolled: 4 2 4 1 4 4 You got Tsiong Wan Tai 3. You did not get the highest 1st prize. Press any key to proceed to the next player. CCPROG1 Machine Project Term 1, AY 2020 – 2021 5 Sample Screen Output (1st prize category, with Golden Flower Rule is Enabled with an existing Ngo-Tsi Tai 5): You rolled: 4 1 4 1 4 4 You got Tsiong Wan Tsah Kim Hweh. You did not get the highest 1st prize. Press any key to proceed to the next player. Sample Screen Output (1st prize category, with Golden Flower Rule is Disabled): You rolled: 4 1 4 1 4 4 You got Tsiong Wan Tai 2. You did not get the highest 1st prize. Press any key to proceed to the next player. End Game The game ends when there are no more prizes left or if a player rolls a Tsiang. At the end of the game, the program should display who gets the 1st prize gift and the roll of the first prize category. Sample Screen Output (Ngo Tsi): All prizes have the claimed. The 1st prize winner goes to player 3 for Ngo Tsi Tai 3. Sample Screen Output (Golden Flower Tsiong Wan): All prizes have the claimed. The 1st prize winner goes to player 3 for Golder Flower Tsiong Wan. Sample Screen Output (Tsiang): All prizes have the claimed. The 1st prize winner goes to player 2 for Tsiang. Bonus Features Last Spin Feature (bonus feature) (1 point bonus) Once all the prizes have been claimed, every player gets a final turn in which they would have a chance to “steal” the first prize. CCPROG1 Machine Project Term 1, AY 2020 – 2021 6 Lut (bonus features) (5 points bonus) The word “Lut” means downgrade or stepdown. This rule is only applicable to first prize. A player downgrades his first prize if he rolls a first prize category twice but his second first prize roll is lower than this first roll effectively giving up his higher roll. This also means that the first prize goes to the 2nd highest first prize roller in the previous turns. Scenario 1: Player 1 – Ngo Tsi Kicker 5 Player 2 – Tsiong Wan Kicker 6 <- This will be the new first prize roll Player 1 – Tsiong Wan Kicker 3 Sample End Game Screen Output (Lut): All prizes have the claimed. The 1st prize winner goes to player 2 for Tsiong Wan Tai 6. Scenario 2: Player 1 – Ngo Tsi Kicker 5 Player 2 – Tsiong Wan Kicker 6 Player 1 – Tsiong Wan Kicker 5 <- This will be the new first prize roll Player 2 – Tsiong Wan Kicker 1 Scenario 3: Player 1 – Ngo Tsi Kicker 5 Player 2 – Tsiong Wan Kicker 6 Player 3 – Tsiong Wan Kicker 5 Player 1 – Tsiong Wan Kicker 4 <- This will be the new first prize roll Player 2 – Tsiong Wan Kicker 3 Player 3 – Tsiong Wan Kicker 2 CCPROG1 Machine Project Term 1, AY 2020 – 2021 7 Documentations and coding standards 1. Follow coding standards. 2. Include internal documentations. 3. Include function specifications in the source code. Before each of your functions, include the comments containing function specifications. Follow the format below: /* Description: what the function does Parameters: param1 what this param1 is for param2 description of param2 : Return value: description */ 4. Create a Test Case document, save as PDF. For each function, identify appropriate test cases/scenarios. Test and validate your functions. Function: function declaration/signature Test Description Input value/parameters Expected output/result Actual output/result Pass/Fai l Case 1 desc P or F Case 2 desc : CCPROG1 Machine Project Term 1, AY 2020 – 2021 8 Important Notes: 1. All source codes (with internal documentation and function specs) and Test Case documents (pdf file) MUST be uploaded in AnimoSpace before January 25, 2021 (23:59). 2. For all submissions made, the following are assumed: a. You worked on the entire project by yourself; b. the submitted files contain your original work; and c. you did not share a part or the entire source code to other people. 3. This is an individual project. Any form of cheating (working in collaboration, asking other person’s help to accomplish a part or the entire MP, copying any code from another person’s work or post) will merit a grade of 0.0 for the CCPROG1 and a discipline case. 4. You will present your project during a scheduled demo. The schedule will be announced later. During the demo, the submitted code will be downloaded, compiled, and executed. 5. Your solution must include use of functions, conditional, and iterative statements. 6. You will incur deductions when: a. The return statement used in a void function. b. Minimal use of user-defined functions. c. Features are either missing or not fully implemented, or instructions are not followed. 7. The following will automatically make your MP score 0: a. Not submitting before the deadline. AnimoSpace flagged your submission as LATE. b. Use of global variables. c. Use of keywords such as goto, continue, and statements such as System.exit(). d. Calling the main() function to make the program execute again. e. Use of break statements in a non-switch block. f. No user-defined functions are used. Your program is just one big main() function. g. Compilation error encountered during the demo. h. No visible outputs on the screen. i. You may use concepts/topics beyond the scope of CCPROG1, but make sure that you understood them. 8. For random generation of numbers, refer to https://www.geeksforgeeks.org/rand-and- srand-in-ccpp/ 9. Well-structed programs may merit a 10pts. Additional bonus References: https://en.wikipedia.org/wiki/Bo_Bing_(game) https://www.geeksforgeeks.org/rand-and-srand-in-ccpp/ https://www.geeksforgeeks.org/rand-and-srand-in-ccpp/ https://en.wikipedia.org/wiki/Bo_Bing_(game)
Explanations and Answers 0

No answers posted

Post your Answer - free or at a fee

Login to your tutor account to post an answer

Posting a free answer earns you +20 points.

Login

NB: Post a homework question for free and get answers - free or paid homework help.

Get answers to: C Programming (Very Basic) Project Making The Bo Bing Chinese Game or similar questions only at Tutlance.

Related Questions