Advertisement
otakus

Untitled

May 6th, 2011
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. int main(void){
  2.  
  3. cout<<"Welcome to Schmahtzee! It's just like Yahtzee...Except, not."<<endl<<endl<<endl;
  4. srand(time(NULL));
  5.  
  6. do
  7. {
  8. roll1=1+rand()%6;
  9. roll2=1+rand()%6;
  10. roll3=1+rand()%6;
  11.  
  12. rollcount++;
  13.  
  14. cout<<"It's time to roll, Player 1!"<<endl<<endl;
  15. cout<<"press any key to roll."<<endl<<endl;
  16. cin>>roll;
  17. cout<<endl<<endl;
  18. cout<<"You rolled: " <<roll1<< ", " <<roll2<< ", and " <<roll3<<"."<<endl<<endl;
  19. cout<<"Would you like to keep these? (y/n)";
  20. cin>>roll;
  21. if (roll=='y'){
  22. if (roll1%2==0&&roll2%2==0&&roll3%2==0){isEven=true;}//3even
  23. if (roll1%2==1&&roll2%2==1&&roll3%2==1){isOdd=true;}//odd
  24. if (roll1==roll2&&roll1==roll3){is3kind=true;} //3 of a kind
  25.  
  26. if (roll1>roll2&&roll1>roll3)//begin 3 in a row
  27. big=roll1;
  28. else if (roll1>roll2&&roll1<roll3)
  29. mid=roll1;
  30. else if (roll1>roll3&&roll1<roll2)
  31. mid=roll1;
  32. else
  33. lil=roll1;
  34.  
  35. if (roll2>roll1&&roll2>roll3)
  36. big=roll2;
  37. else if (roll2>roll1&&roll2>roll3)
  38. mid=roll2;
  39. else if (roll2>roll3&&roll2<roll1)
  40. mid=roll2;
  41. else
  42. lil=roll2;
  43.  
  44. if (roll3>roll1&&roll3>roll2)
  45. big=roll3;
  46. else if (roll3>roll1&&roll3<roll2)
  47. mid=roll3;
  48. else if (roll3>roll2&&roll3<roll1)
  49. mid=roll3;
  50. else
  51. lil=roll3;
  52.  
  53. if (big==mid+1&&big==lil+2){is3inarow=true;}//end 3 in a row
  54. if(roll1==roll2||roll2==roll3||roll1==roll3){is2kind=true;}//2 of a kind
  55.  
  56. cout<<"You could put them in: ";
  57. if(isEven)cout<<"3 Evens";
  58. if(isOdd)cout<<"3 Odds";
  59. if(is3kind)cout<<"3 of a kind";
  60. if(is2kind)cout<<"2 of a kind";
  61. if(is3inarow)cout<<"3 in a row";
  62.  
  63. //more code here
  64. }
  65.  
  66. }
  67. while (rollcount<3);
  68. return 0;
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement