Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(void){
- cout<<"Welcome to Schmahtzee! It's just like Yahtzee...Except, not."<<endl<<endl<<endl;
- srand(time(NULL));
- do
- {
- roll1=1+rand()%6;
- roll2=1+rand()%6;
- roll3=1+rand()%6;
- rollcount++;
- cout<<"It's time to roll, Player 1!"<<endl<<endl;
- cout<<"press any key to roll."<<endl<<endl;
- cin>>roll;
- cout<<endl<<endl;
- cout<<"You rolled: " <<roll1<< ", " <<roll2<< ", and " <<roll3<<"."<<endl<<endl;
- cout<<"Would you like to keep these? (y/n)";
- cin>>roll;
- if (roll=='y'){
- if (roll1%2==0&&roll2%2==0&&roll3%2==0){isEven=true;}//3even
- if (roll1%2==1&&roll2%2==1&&roll3%2==1){isOdd=true;}//odd
- if (roll1==roll2&&roll1==roll3){is3kind=true;} //3 of a kind
- if (roll1>roll2&&roll1>roll3)//begin 3 in a row
- big=roll1;
- else if (roll1>roll2&&roll1<roll3)
- mid=roll1;
- else if (roll1>roll3&&roll1<roll2)
- mid=roll1;
- else
- lil=roll1;
- if (roll2>roll1&&roll2>roll3)
- big=roll2;
- else if (roll2>roll1&&roll2>roll3)
- mid=roll2;
- else if (roll2>roll3&&roll2<roll1)
- mid=roll2;
- else
- lil=roll2;
- if (roll3>roll1&&roll3>roll2)
- big=roll3;
- else if (roll3>roll1&&roll3<roll2)
- mid=roll3;
- else if (roll3>roll2&&roll3<roll1)
- mid=roll3;
- else
- lil=roll3;
- if (big==mid+1&&big==lil+2){is3inarow=true;}//end 3 in a row
- if(roll1==roll2||roll2==roll3||roll1==roll3){is2kind=true;}//2 of a kind
- cout<<"You could put them in: ";
- if(isEven)cout<<"3 Evens";
- if(isOdd)cout<<"3 Odds";
- if(is3kind)cout<<"3 of a kind";
- if(is2kind)cout<<"2 of a kind";
- if(is3inarow)cout<<"3 in a row";
- //more code here
- }
- }
- while (rollcount<3);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement