Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void morecraps()
- {
- int losecount = 0;
- int wincount = 0;
- int firstwin = 0;
- int firstlose = 0;
- int pointwin = 0;
- int nopoint = 0;
- for (int i = 0 ; i < 100000 ; i++){
- Dice d1 = new Dice(6);
- Dice d2 = new Dice(6);
- //roll 1 -
- int first = d1.roll();
- int second = d2.roll();
- int pp = first+second;
- if (first+second == 11 || first+second == 7){
- wincount++;
- firstwin++;
- } else if (first+second == 12 || first+second == 3 || first+second == 2){
- losecount++;
- firstlose++;
- // first roll win / lose scenarios
- } else{
- int r1 = 0;
- int r2 = 0;
- while ((r1+r2) != pp && (r1+r2)!= 7){
- // loop stops if player makes point or rolls a 7.
- r1 = d1.roll();
- r2 = d2.roll();
- }
- // rolls for every roll besides the first;
- // variables used inside the while loop so that it doesn't use
- // the *set* variables from outside which would cause it to loop forever.
- if (r1+r2 == pp){
- wincount++;
- pointwin++;
- // win and lose scenarios (making point or not making point)
- }
- else if (r1+r2 == 7){
- losecount++;
- nopoint++;
- }
- }
- // No returns to menu, Yes runs the program again.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement