Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do help me in making this difficult Code. C programming code Instructions and outputs given in the picture Carefully read the instructions and Make

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Please do help me in making this difficult Code. C programming code Instructions and outputs given in the picture Carefully read the instructions and Make the same output as given.

YES WE NEED TO CODE IN C LANGUAGE

what information do yu need let me know please?

Part-2 (40%) Instructions Part-2 involves implementing the gameplay logic based on the configuration settings done from Part-1. . o o o o o 1. Review the "Part-2 Output Example" (next section) to see how the application is expected to work Reminder: This game is highly user-configurable and should be coded to implement the settings as defined by the user and not be limited to just the example provided - you will have to test your work thoroughly in both part's 1 and 21 2. Code your program in a file named "w5p2.c" 3. Display the "board" which includes: Line-1: The player's most recent move position identified using the player's set symbol Line-2: The game path: o : represents undiscovered locations (use below to print this symbol) printf("%c", 177); o !: represents bombs $: represents treasure &: represents both a bomb and treasure . : represents a visited location that had neither a bomb nor a treasure o Hint: Use the player's history member array to determine if you should reveal the hidden bomb and/or treasure, if a player has visited the position/location, then check what symbol to show by checking the game's bombs and treasure member array's Line-3: Position/location ruler (major) which will show the 1" number in every 10 positions (10, 20, 30, etc.) Line-4: Position/location ruler (minor) which shows each numeric position starting at 1 Note: The 'ruler' helps the user quickly locate positions and identify previously entered move commands. Hint: This is dynamically displayed based on the game's setting for the path length member 4. Display the player's statistics. Lives: is a counter of how many lives are remaining (when this is zero, gameplay ends) Treasures is a counter of how many treasures were found during gameplay Moves Remaining: is a countdown of remaining moves (when this is zero, gameplay ends) Use the following (add the variables for substitution accordingly where needed): printf("+- -- + "); printf(" Lives: %2d | Treasures: %2d | Moves Remaining: %2d "... printf("+ - + "); o . . . . . . 0 O 5. Prompt for the player's next move (location along the path) The entered value must be at least 1 and no more than the game's configuration setting for the path length Validation should repeat as many times as necessary until a valid value is entered 6. Check to see if the entered location was previously visited You should refer to the player's history array to see if the location was previously visited (the value will be 1) If the location was previously visited, display a meaningful message to indicate the location has already been visited . Do NOT deduct a move from the game's move counter 7. If the entered location was not previously visited: Record the location to the player's history array by setting the appropriate element value to 1 (the index is determined by the entered location) Reduce the moves counter by 1 Check the game's bomb member array (the index is determined by the entered location) to see if there is a hidden bomb (value will be 1) Reduce the player's lives counter by 1 Display an appropriate message (use symbol: [!] to denote a bomb) Check the game's treasure member array (the index is determined by the entered location) to see if there is a hidden treasure (value will be 1) Increase the player's treasure counter by 1 o Display an appropriate message (use symbol: [$] to denote a treasure) Check for BOTH a bomb AND a treasure Check both the bomb and treasure member arrays to see if a value of 1 is set for both at the same location o Update the player's counters accordingly (bomb: reduce lives, treasure: increase treasure counter) Display an appropriate message (use symbol: [&] to denote a bomb AND treasure, the treasure is considered a "life insurance payout") If there is no bomb or treasure at the location entered by the user o Display an appropriate message (use symbol: (.) to denote nothing found) Note: The symbols used in the messages will match to what is shown in the game's board when displayed (step #3 "line-2") 8. Keep iterating (looping) (from #3) until the gameplay ends based on the following criteria: The number of player lives reaches 0 The number of allowed moves reaches 0 9. Display a "Game Over" message along with an exit/end of program message. . o . O o . . . Part-2 Output Example (Note: Use this data for submission) Treasure Hunt! BEDRE PLAYER Configuration Enter a single character to represent the player: V Set the number of lives: @ Must be between 1 and 101 Set the number of lives: 11 Must be between 1 and 101 Set the number of lives: 3 Player configuration set-up is complete GAME Configuration Set the path length (a multiple of 5 between 10-70): 9 Must be a multiple of 5 and between 10-40!|! Set the path length (a multiple of 5 between 10-70): 41 Must be a multiple of 5 and between 10-40!|! Set the path length (a multiple of 5 between 10-70): 19 Must be a multiple of 5 and between 10-40!!! Set the path length (a multiple of 5 between 10-70): 20 Set the limit for number of moves allowed: 2 Value must be between 3 and 15 Set the limit for number of moves allowed: 16 Value must be between 3 and 15 Set the limit for number of moves allowed: 10 BOMB Placement Enter the bomb positions in sets of 5 where a value of 1=BOMB, and OENO BOMB. Space-delimit your input. (Example: 1 0 0 1 1) NOTE: there are 20 to set! Positions. [ 1- 5]: 1 0 0 1 1 Positions [ 6-10]: 1 1 0 0 0 Positions (11-15): 0 0 1 1 1 Positions (16-20]: 1 0 0 0 0 BOMB placement set TREASURE Placement Enter the treasure placements in sets of 5 where a value of 1=TREASURE, and D=NO TREASURE. Space-delimit your input. (Example: 1 0 0 1 1) NOTE: there are 20 to set! Positions [ 1- 5]: 0 1 1 0 0 Positions [ 6-10): 0 0 0 0 0 ? Positions [11-15]: 1 1 0 0 1 Positions [16-20]: @ 1 1 1 1 TREASURE placement set GAME configuration set-up is complete... TREASURE HUNT Configuration Settings Player: Symbol Lives Treasure History : V : 3 : [ready for gameplay] : [ready for gameplay] Game: Path Length: 20 Bombs : 10011110000011110000 Treasure : 01100000001100101111 EEEE ========== ~ Get ready to play TREASURE HUNT! - TITTII|||1|||||||||2 12345678901234567890 Lives: 3 | Treasures: Moves Remaining: 10 Next Move (1-20]: 0 Out of Range!!! Next Move [1-20]: 21 Out of Range!!! Next Move [1-20]: 8 ======> [:] ... Nothing found here... [-] V Hl|||1|||||||||2 12345678901234567890 01 Moves Remaining: 9 Lives: 3 / Treasures: + Next Move [1-20): 10 ===============> [:) ... Nothing found here... [-] TIITTIT||1|||||||||2 12345678901234567890 e | Moves Remaining: 8 Lives: 3 | Treasures: +-- Next Move (1-20]: 1 ==========> [1] ||| B00000M !|! [!] V TI|||||1|||||||||2 12345678901234567890 0 | Moves Remaining: 7 Lives: 2 | Treasures : +---- Next Move (1-20]: 15 ===============> [&] !!! BOO000M 1!! [&] ===============> [&] $$$ Life Insurance Payout!!! [&] |||||||||1||||||||||2 12345678901234567890 Lives: 1 | Treasures: 1 | Moves Remaining: 6 Next Move [1-20]: 20 ==== =========> [$] $$$ Found Treasure! $$$ [$] V T||||||2 12345678901234567890 2 | Moves Remaining: 5 Lives: 1 Treasures: +- Next Move (1-20]: 8 ========> Dope! You've been here before! & $ TTTTTT|||1|||||||||2 12345678901234567890 Lives: 1 | Treasures: 2 | Moves Remaining: 5 Next Move (1-20]: 3 ===============> [$] $$$ Found Treasurel $$$ [$] TITI||||1|||||||||2 12345678901234567890 3 | Moves Remaining: 4 Lives: 1 | Treasures: +--- Next Move [1-20]: 5 ===============> [!] !!! B0000OM !!! [!] No more LIVES remaining! V $19.S. T||||||||1|||||||||2 12345678901234567890 Lives: 0 | Treasures: 3 | Moves Remaining: 3 ################## # Game over! # ################## You should play again and try to beat your score! Reflection (50%) Instructions Create a text file named reflect.txt" Record your answer in the reflect.txt file for each of the following: 1. Describe the benefits and advantages of using user-defined types (structures) in this workshop. You must explain your answer using an example from this workshop. 2. If we enhanced this workshop to keep a history of games played including the endgame results, briefly describe what two major logical changes you would have to make to your program to make this possible? 3. What part of this workshop did you spend the most time working on? What did you do to overcome your difficulties? Part-2 (40%) Instructions Part-2 involves implementing the gameplay logic based on the configuration settings done from Part-1. . o o o o o 1. Review the "Part-2 Output Example" (next section) to see how the application is expected to work Reminder: This game is highly user-configurable and should be coded to implement the settings as defined by the user and not be limited to just the example provided - you will have to test your work thoroughly in both part's 1 and 21 2. Code your program in a file named "w5p2.c" 3. Display the "board" which includes: Line-1: The player's most recent move position identified using the player's set symbol Line-2: The game path: o : represents undiscovered locations (use below to print this symbol) printf("%c", 177); o !: represents bombs $: represents treasure &: represents both a bomb and treasure . : represents a visited location that had neither a bomb nor a treasure o Hint: Use the player's history member array to determine if you should reveal the hidden bomb and/or treasure, if a player has visited the position/location, then check what symbol to show by checking the game's bombs and treasure member array's Line-3: Position/location ruler (major) which will show the 1" number in every 10 positions (10, 20, 30, etc.) Line-4: Position/location ruler (minor) which shows each numeric position starting at 1 Note: The 'ruler' helps the user quickly locate positions and identify previously entered move commands. Hint: This is dynamically displayed based on the game's setting for the path length member 4. Display the player's statistics. Lives: is a counter of how many lives are remaining (when this is zero, gameplay ends) Treasures is a counter of how many treasures were found during gameplay Moves Remaining: is a countdown of remaining moves (when this is zero, gameplay ends) Use the following (add the variables for substitution accordingly where needed): printf("+- -- + "); printf(" Lives: %2d | Treasures: %2d | Moves Remaining: %2d "... printf("+ - + "); o . . . . . . 0 O 5. Prompt for the player's next move (location along the path) The entered value must be at least 1 and no more than the game's configuration setting for the path length Validation should repeat as many times as necessary until a valid value is entered 6. Check to see if the entered location was previously visited You should refer to the player's history array to see if the location was previously visited (the value will be 1) If the location was previously visited, display a meaningful message to indicate the location has already been visited . Do NOT deduct a move from the game's move counter 7. If the entered location was not previously visited: Record the location to the player's history array by setting the appropriate element value to 1 (the index is determined by the entered location) Reduce the moves counter by 1 Check the game's bomb member array (the index is determined by the entered location) to see if there is a hidden bomb (value will be 1) Reduce the player's lives counter by 1 Display an appropriate message (use symbol: [!] to denote a bomb) Check the game's treasure member array (the index is determined by the entered location) to see if there is a hidden treasure (value will be 1) Increase the player's treasure counter by 1 o Display an appropriate message (use symbol: [$] to denote a treasure) Check for BOTH a bomb AND a treasure Check both the bomb and treasure member arrays to see if a value of 1 is set for both at the same location o Update the player's counters accordingly (bomb: reduce lives, treasure: increase treasure counter) Display an appropriate message (use symbol: [&] to denote a bomb AND treasure, the treasure is considered a "life insurance payout") If there is no bomb or treasure at the location entered by the user o Display an appropriate message (use symbol: (.) to denote nothing found) Note: The symbols used in the messages will match to what is shown in the game's board when displayed (step #3 "line-2") 8. Keep iterating (looping) (from #3) until the gameplay ends based on the following criteria: The number of player lives reaches 0 The number of allowed moves reaches 0 9. Display a "Game Over" message along with an exit/end of program message. . o . O o . . . Part-2 Output Example (Note: Use this data for submission) Treasure Hunt! BEDRE PLAYER Configuration Enter a single character to represent the player: V Set the number of lives: @ Must be between 1 and 101 Set the number of lives: 11 Must be between 1 and 101 Set the number of lives: 3 Player configuration set-up is complete GAME Configuration Set the path length (a multiple of 5 between 10-70): 9 Must be a multiple of 5 and between 10-40!|! Set the path length (a multiple of 5 between 10-70): 41 Must be a multiple of 5 and between 10-40!|! Set the path length (a multiple of 5 between 10-70): 19 Must be a multiple of 5 and between 10-40!!! Set the path length (a multiple of 5 between 10-70): 20 Set the limit for number of moves allowed: 2 Value must be between 3 and 15 Set the limit for number of moves allowed: 16 Value must be between 3 and 15 Set the limit for number of moves allowed: 10 BOMB Placement Enter the bomb positions in sets of 5 where a value of 1=BOMB, and OENO BOMB. Space-delimit your input. (Example: 1 0 0 1 1) NOTE: there are 20 to set! Positions. [ 1- 5]: 1 0 0 1 1 Positions [ 6-10]: 1 1 0 0 0 Positions (11-15): 0 0 1 1 1 Positions (16-20]: 1 0 0 0 0 BOMB placement set TREASURE Placement Enter the treasure placements in sets of 5 where a value of 1=TREASURE, and D=NO TREASURE. Space-delimit your input. (Example: 1 0 0 1 1) NOTE: there are 20 to set! Positions [ 1- 5]: 0 1 1 0 0 Positions [ 6-10): 0 0 0 0 0 ? Positions [11-15]: 1 1 0 0 1 Positions [16-20]: @ 1 1 1 1 TREASURE placement set GAME configuration set-up is complete... TREASURE HUNT Configuration Settings Player: Symbol Lives Treasure History : V : 3 : [ready for gameplay] : [ready for gameplay] Game: Path Length: 20 Bombs : 10011110000011110000 Treasure : 01100000001100101111 EEEE ========== ~ Get ready to play TREASURE HUNT! - TITTII|||1|||||||||2 12345678901234567890 Lives: 3 | Treasures: Moves Remaining: 10 Next Move (1-20]: 0 Out of Range!!! Next Move [1-20]: 21 Out of Range!!! Next Move [1-20]: 8 ======> [:] ... Nothing found here... [-] V Hl|||1|||||||||2 12345678901234567890 01 Moves Remaining: 9 Lives: 3 / Treasures: + Next Move [1-20): 10 ===============> [:) ... Nothing found here... [-] TIITTIT||1|||||||||2 12345678901234567890 e | Moves Remaining: 8 Lives: 3 | Treasures: +-- Next Move (1-20]: 1 ==========> [1] ||| B00000M !|! [!] V TI|||||1|||||||||2 12345678901234567890 0 | Moves Remaining: 7 Lives: 2 | Treasures : +---- Next Move (1-20]: 15 ===============> [&] !!! BOO000M 1!! [&] ===============> [&] $$$ Life Insurance Payout!!! [&] |||||||||1||||||||||2 12345678901234567890 Lives: 1 | Treasures: 1 | Moves Remaining: 6 Next Move [1-20]: 20 ==== =========> [$] $$$ Found Treasure! $$$ [$] V T||||||2 12345678901234567890 2 | Moves Remaining: 5 Lives: 1 Treasures: +- Next Move (1-20]: 8 ========> Dope! You've been here before! & $ TTTTTT|||1|||||||||2 12345678901234567890 Lives: 1 | Treasures: 2 | Moves Remaining: 5 Next Move (1-20]: 3 ===============> [$] $$$ Found Treasurel $$$ [$] TITI||||1|||||||||2 12345678901234567890 3 | Moves Remaining: 4 Lives: 1 | Treasures: +--- Next Move [1-20]: 5 ===============> [!] !!! B0000OM !!! [!] No more LIVES remaining! V $19.S. T||||||||1|||||||||2 12345678901234567890 Lives: 0 | Treasures: 3 | Moves Remaining: 3 ################## # Game over! # ################## You should play again and try to beat your score! Reflection (50%) Instructions Create a text file named reflect.txt" Record your answer in the reflect.txt file for each of the following: 1. Describe the benefits and advantages of using user-defined types (structures) in this workshop. You must explain your answer using an example from this workshop. 2. If we enhanced this workshop to keep a history of games played including the endgame results, briefly describe what two major logical changes you would have to make to your program to make this possible? 3. What part of this workshop did you spend the most time working on? What did you do to overcome your difficulties

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases 28th British National Conference On Databases Bncod 28 Manchester Uk July 2011 Revised Selected Papers Lncs 7051

Authors: Alvaro A.A. Fernandes ,Alasdair J.G. Gray ,Khalid Belhajjame

2011th Edition

3642245765, 978-3642245763

More Books

Students also viewed these Databases questions

Question

(5) What is the regression matrix (A) for this example? Pg45

Answered: 1 week ago