Shaker AlSalem

Shaker AlSalem

  • NA
  • 25
  • 17.7k

Can anyone help with arrays

Mar 3 2012 6:23 PM
Can anyone please help me write this in a console app

Thank you so much for your time and support.
The game of Craps consists on rolling a pair of dice as many times as possible until you either win or lose. The rules are as follows:
- If in the first roll you get a 7 or 11, you win in the first throw
- If in the first roll you get a 2, 3 or 12, you lose in the first throw
- If you get any other value, that value becomes the "point". Then you keep throwing the dice until you either get the "point" to win or a 7 to lose.
These are the basics of the game, side bets are a different topic.
Simulate the playing game of Craps 10000 times. And make your code answer the following questions:
- How many times you got to WIN / LOSE
- How Many times you won/lost in the first roll
- How Many times you won/lost in the 2nd, 3rd, 4th.........10th roll and more than 10 rolls.
You should have a method named PlayCraps that plays one single game of craps that will allow you to find out if you win or loose and the length of the game in the number of throws. You will get to design how will that be accomplished.

_________________________________

int PlayCraps (ref bool isWin)

- return the number of times the dice were thrown
int n = 0;
bool isWin = true;
n = PlayCraps(ref isWin);
if (isWin)
{
//for a win
}
else
{
///for a loss
}

Answers (3)