Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Stuck in the mud is a popular dice game in UK. The game uses five (5) 6-sided dice to play. The players play in turns.

Choose one player to start the game. The player will roll all five (5) dice. If the player rolled any 2s or 5s, the player does not score any points for this throw.

The player can only score on a roll which does not include the number 2 and 5. Any dice with a 2 or a 5 becomes stuck in the mud. If this throw does not contain any 2s or 5s, the score is incremented by the sum of the dice values.

The player needs to set aside any 2s and 5s and throw the remaining dice. Again, if any 2s or 5s are rolled, the score will not be incremented for this throw.

Throws without 2s and 5s are added to the previous total score. Continue in this way until all the dice are stuck. Save the score and pass the dice to the next player.

Players can agree a total number of rounds to play in advance. Total up the score. The player with the highest score wins the game. The following link contains the detail game description

Write a MATLAB program to simulate the Stuck in the Mud game with additional features that can:

• Use five (5) 6-sided dice to automatically play the Stuck in the Mud game against a player.

• Greet the player when the game starts.

• Let the player to choose the number of rounds to play. Take care of the user input to ensure the program will not crash with inputs like 0, 1.2, -1, 999, and so on...

• The program should not play if the user enters a 0 or any negative value.

• The program should accurately play the number of rounds specified by the user. The player and the computer play in turns for each round.

• The program can always pick one side to start the game first, either the player side or the computer side. Randomly pick a side to start the rotation is optional.

• Print the current round number clearly in the command window.

• If the player side starts first, the program will automatically roll all five (5) dice for the player. If the player rolled any 2s or 5s, the player does not score any points for this throw.

The player can only score on a roll which does not include the number 2 and 5. Any dice with a 2 or a 5 becomes stuck in the mud. If this throw does not contain any 2s or 5s, the score is incremented by the sum of the dice values. The player needs to set aside any 2s and 5s and throw the remaining dice. Again, if any 2s or 5s are rolled, the score will not be incremented for this throw. Throws without 2s and 5s are added to the previous total score. Continue in this way until all the dice are stuck.

• The dice rolled for the player, the stuck dice, and the scores during the process should clearly be printed in the command window.

• The program then automatically roll all five (5) dice for the computer. Follow the game rules until all five (5) dice are stuck.

• The dice rolled for the computer, the stuck dice, and the scores during the process should also be clearly printed in the command window.

• Accurately track the total scores for the player and the computer.

• After all the rounds have been played, select a winner based on the highest total score. It is also possible that the game ends in a tie.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93125519

Have any Question?


Related Questions in Computer Engineering

What type of monopoly is sydney water describe the main

What type of monopoly is Sydney Water? Describe the main characteristics of this monopoly type in general and in relation to Sydney Water.

In c languageread a double number as 2 digits after the

In C language: Read a double number as 2 digits after the decimal point. The number should have at least 6 digits BEFORE the decimal point. Extract all digits at even positions. Print them in reverse order. Extract all d ...

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

You isolate an acidic compound by suction filtration and

You isolate an acidic compound by suction filtration and think it is still wet. How do you remove the remaining water without the risk of decomposition (no extreme heating)

Question suppose that in responding to interrupts from an

Question : Suppose that in responding to interrupts from an I/O device the processor consumes 1000 cycles in performing the context switch required to transfer control to the interrupt handler. Servicing the device reque ...

Question specify design and implement a class for a card in

Question : Specify, design, and implement a class for a card in a deck of playing cards. The object should contain methods for setting and retrieving the suit and rank of a card. In C++ please

In simple python form pleasewrite a script that asks the

In Simple Python form please: Write a script that asks the user to input the name of a file, opens the file, reads its contents, prints the contents of the file on the screen, and closes the file. If no such file exists, ...

The rate of inflation in year 1 is expected to be 14 year

The rate of inflation in year 1 is expected to be 1.4%, year two is 1.8%, and years three through five is expected to be 2%. Assume the real risk-free rate, r*, is 3% for all maturities. What should the yield to maturity ...

Request this to be done in jgrasp1 add a method to the

Request this to be done in JGrasp 1. Add a method to the program that calculates the cube of every number between a lower bound and an upper bound that a user inputs (for instance, lower bound 1 and upper bound 9, for be ...

Question a series of information frames with a mean length

Question : A series of information frames with a mean length of 1000 bits is to be transmitted across a data link 4000km long at a data rate of 2Mbps. If the link has a velocity of propagation of 2 *10 8 ms -1 and a BER ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As