Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a matlab program for the following: At the start of the game, each player receives a paper that will track the number of

Please write a matlab program for the following:

At the start of the game, each player receives a paper that will track the number of lives that player has. Each player starts the game with 6 lives. In the first round, all players take their turn and roll the 2 dice. Each players score in that round is simply the sum of both dice. The player(s) with the lowest roll in that turn loses one life and must change his personal life count (from 6 to 5). The game is continued and each round at least one player loses a life. When a player has lost all his or her lives, that player no longer participates in the game. The game ends when there is only one player left and all other players have lost all their lives. As the game is simple and easy to follow, it is often used as a drinking game or a gambling game. There are also several variations of this popular dice game that follow different scoring mechanics to eliminate a life each round. Write a MATLAB program to simulate the Wild, Wild, West! dice game that can: Automatically play the Wild, Wild, West! dice game for any number of players (input by the game host). Automatically roll 2 dice for every player participates in the game and clearly print the dice values in the command window. Automatically sum both dice values together for each player and print the score (the sum of both dice) for everyone participates in the command window. Automatically find the lowest score of the round and print the lowest score in the command window. Automatically identify the player(s) with the lowest score and print the player number(s) with the lowest score in the command window. Automatically reduce one life for the player(s) with the lowest score. Automatically print the number of lives for every player in the command window at the end of each round. When a player has lost all lives, the player can no longer participate the game. The program should automatically stop showing the dice rolled by the players with no life. The program should also automatically skip the players with no life when determine which player gets the lowest score of the round. The game should keep automatically playing until only 1 or 0 player left. At the end of the game, identify the winning player number and congratulate the winner in the command window. It is also possible that everyone died at the end of the game. In this case, clearly print a message in the command window.

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

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions