Advertisement
sshomette

Untitled

Sep 4th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. public static void morecraps()
  2. {
  3. int losecount = 0;
  4. int wincount = 0;
  5. int firstwin = 0;
  6. int firstlose = 0;
  7. int pointwin = 0;
  8. int nopoint = 0;
  9.  
  10. for (int i = 0 ; i < 100000 ; i++){
  11. Dice d1 = new Dice(6);
  12. Dice d2 = new Dice(6);
  13.  
  14. //roll 1 -
  15. int first = d1.roll();
  16. int second = d2.roll();
  17. int pp = first+second;
  18.  
  19.  
  20. if (first+second == 11 || first+second == 7){
  21. wincount++;
  22. firstwin++;
  23. } else if (first+second == 12 || first+second == 3 || first+second == 2){
  24. losecount++;
  25. firstlose++;
  26.  
  27. // first roll win / lose scenarios
  28.  
  29. } else{
  30. int r1 = 0;
  31. int r2 = 0;
  32. while ((r1+r2) != pp && (r1+r2)!= 7){
  33.  
  34. // loop stops if player makes point or rolls a 7.
  35.  
  36. r1 = d1.roll();
  37. r2 = d2.roll();
  38. }
  39. // rolls for every roll besides the first;
  40. // variables used inside the while loop so that it doesn't use
  41. // the *set* variables from outside which would cause it to loop forever.
  42.  
  43. if (r1+r2 == pp){
  44. wincount++;
  45. pointwin++;
  46.  
  47. // win and lose scenarios (making point or not making point)
  48.  
  49. }
  50. else if (r1+r2 == 7){
  51. losecount++;
  52. nopoint++;
  53. }
  54. }
  55.  
  56. // No returns to menu, Yes runs the program again.
  57.  
  58.  
  59.  
  60. }
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement