Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // simone.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <iostream>
- #include <conio.h>
- #include <stdlib.h>
- #include <Windows.h>
- #include <iomanip>
- #include <string>
- #include <time.h>
- using namespace std;
- int p1_3odd1, p1_3even1, p1_3ofakind1, p1_2ofakind1, p1_3inarow1;
- int p1_3odd2, p1_3even2, p1_3ofakind2, p1_2ofakind2, p1_3inarow2;
- int p2_3odd1, p2_3even1, p2_3ofakind1, p2_2ofakind1, p2_3inarow1;
- int p2_3odd2, p2_3even2, p2_3ofakind2, p2_2ofakind2, p2_3inarow2;
- int roll1, roll2, roll3;
- int big,mid,lil;
- char roll;
- int rollcount;
- 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;
- roll1=1;
- roll2=2;
- roll3=3;
- rollcount++;
- cout<<"It's time for your first roll, Player 1!"<<endl<<endl;
- cout<<"Hit the 'r' button when you're ready!"<<endl<<endl;
- cin>>roll;
- cout<<endl<<endl;
- cout<<"You rolled: " <<roll1<< ", " <<roll2<< ", and " <<roll3<<"."<<endl<<endl;
- cout<<"Would you like to keep these? You have spaces in 3 odds, 3 evens, 3 of a kind, 2 of a kind, and 3 in a row."<<endl;
- cin>>roll;
- if (roll=='y'){
- if (roll1%2==0&&roll2%2==0&&roll3%2==0){}//3even
- if (roll1%2==1&&roll2%2==1&&roll3%2==1){}//odd
- if (roll1==roll2&&roll1==roll3){} //3 of a kind
- if (roll1>roll2&&roll1>roll3)
- 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){
- cout<<"in order";
- }
- }
- }
- while (rollcount<3);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement