Advertisement
otakus

Untitled

May 6th, 2011
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. // simone.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6.  
  7. #include <iostream>
  8. #include <conio.h>
  9. #include <stdlib.h>
  10. #include <Windows.h>
  11. #include <iomanip>
  12. #include <string>
  13. #include <time.h>
  14.  
  15. using namespace std;
  16.  
  17. int p1_3odd1, p1_3even1, p1_3ofakind1, p1_2ofakind1, p1_3inarow1;
  18. int p1_3odd2, p1_3even2, p1_3ofakind2, p1_2ofakind2, p1_3inarow2;
  19. int p2_3odd1, p2_3even1, p2_3ofakind1, p2_2ofakind1, p2_3inarow1;
  20. int p2_3odd2, p2_3even2, p2_3ofakind2, p2_2ofakind2, p2_3inarow2;
  21. int roll1, roll2, roll3;
  22. int big,mid,lil;
  23. char roll;
  24. int rollcount;
  25.  
  26.  
  27. int main(void){
  28. cout<<"Welcome to Schmahtzee! It's just like Yahtzee...Except, not."<<endl<<endl<<endl;
  29. srand(time(NULL));
  30. do {
  31. roll1=1+rand()%6;
  32. roll2=1+rand()%6;
  33. roll3=1+rand()%6;
  34.  
  35. roll1=1;
  36. roll2=2;
  37. roll3=3;
  38.  
  39. rollcount++;
  40.  
  41. cout<<"It's time for your first roll, Player 1!"<<endl<<endl;
  42. cout<<"Hit the 'r' button when you're ready!"<<endl<<endl;
  43. cin>>roll;
  44. cout<<endl<<endl;
  45. cout<<"You rolled: " <<roll1<< ", " <<roll2<< ", and " <<roll3<<"."<<endl<<endl;
  46. 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;
  47. cin>>roll;
  48. if (roll=='y'){
  49. if (roll1%2==0&&roll2%2==0&&roll3%2==0){}//3even
  50. if (roll1%2==1&&roll2%2==1&&roll3%2==1){}//odd
  51. if (roll1==roll2&&roll1==roll3){} //3 of a kind
  52. if (roll1>roll2&&roll1>roll3)
  53. big=roll1;
  54. else if (roll1>roll2&&roll1<roll3)
  55. mid=roll1;
  56. else if (roll1>roll3&&roll1<roll2)
  57. mid=roll1;
  58. else
  59. lil=roll1;
  60.  
  61. if (roll2>roll1&&roll2>roll3)
  62. big=roll2;
  63. else if (roll2>roll1&&roll2>roll3)
  64. mid=roll2;
  65. else if (roll2>roll3&&roll2<roll1)
  66. mid=roll2;
  67. else
  68. lil=roll2;
  69.  
  70. if (roll3>roll1&&roll3>roll2)
  71. big=roll3;
  72. else if (roll3>roll1&&roll3<roll2)
  73. mid=roll3;
  74. else if (roll3>roll2&&roll3<roll1)
  75. mid=roll3;
  76. else
  77. lil=roll3;
  78.  
  79. if(big==mid+1&&big==lil+2){
  80. cout<<"in order";
  81. }
  82. }
  83. }
  84. while (rollcount<3);
  85. return 0;
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement