| Welcome to C++ Game Dev. We hope you enjoy your visit.
You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.
Join our community!
If you're already a member please log in to your account to access all of our features:
|
Petals Around The Rose, A Neat Dice/Logic Game!
| gamehawk |
|

Master Member
          
Group: Admin
Posts: 1,363
Member No.: 15
Joined: 11-December 05

|
So yesterday I was bored sitting around nothin' to do. So I play this game called Petals Around the Rose, I got frustrated wtih it. After and hour and a half of trying to find the forumula I couldn't. So I looked it up (I cheatedd yes, yes). Anyways I made a C++ version of the game. I'll release it as source so if you get frustrated you can look at it to see the solution. If you want to solve it yourself don't look too closely at the source.
| CODE | #include <iostream> #include <time.h> using namespace std; void help() { system("cls"); cout<<"Help:"<<endl; cout<<"Petals around the roses is dice/logic game. You have to solve the puzzle,\na roll of five dice is given and you have to figure out how many petals there \nare. Try to solve this puzzle, the name of the game is important.\nI read about this on the Inernet.Bill Gates played it, it's a good story.\nRead it by searching Petals Around the Rose on Google."<<endl; system("pause"); } void game() { system("cls"); cout<<"Petals Around the Rose"<<endl; cout<<"Made By GameHawk"<<endl; system("PAUSE"); cout<<"Ready? <Press Enter To Begin>"<<endl; system("pause"); system("cls"); srand(time(NULL)); int a=rand()%6+1; int b=rand()%6+1; int c=rand()%6+1; int d=rand()%6+1; int e=rand()%6+1; int f=rand()%6+1; int total=0; int guess=0; //check and output cout<<"Die I:"<<endl; switch(a){case 1:cout<<"\n *\n"<<endl;break;case 2:cout<<"*\n\n *"<<endl;break;case 3:cout<<"*\n *\n *"<<endl;total+=2;break;case 4:cout<<"* *\n* *"<<endl;break;case 5:cout<<"* *\n *\n* *"<<endl;total+=4;break;case 6:cout<<"* *\n* *\n* *"<<endl;break;} cout<<"Die II:"<<endl; switch(b){case 1:cout<<"\n *\n"<<endl;break;case 2:cout<<"*\n\n *"<<endl;break;case 3:cout<<"*\n *\n *"<<endl;total+=2;break;case 4:cout<<"* *\n* *"<<endl;break;case 5:cout<<"* *\n *\n* *"<<endl;total+=4;break;case 6:cout<<"* *\n* *\n* *"<<endl;break;} cout<<"Die III:"<<endl; switch(c){case 1:cout<<"\n *\n"<<endl;break;case 2:cout<<"*\n\n *"<<endl;break;case 3:cout<<"*\n *\n *"<<endl;total+=2;break;case 4:cout<<"* *\n* *"<<endl;break;case 5:cout<<"* *\n *\n* *"<<endl;total+=4;break;case 6:cout<<"* *\n* *\n* *"<<endl;break;} cout<<"Die IV:"<<endl; switch(d){case 1:cout<<"\n *\n"<<endl;break;case 2:cout<<"*\n\n *"<<endl;break;case 3:cout<<"*\n *\n *"<<endl;total+=2;break;case 4:cout<<"* *\n* *"<<endl;break;case 5:cout<<"* *\n *\n* *"<<endl;total+=4;break;case 6:cout<<"* *\n* *\n* *"<<endl;break;} cout<<"Die V:"<<endl; switch(e){case 1:cout<<"\n *\n"<<endl;break;case 2:cout<<"*\n\n *"<<endl;break;case 3:cout<<"*\n *\n *"<<endl;total+=2;break;case 4:cout<<"* *\n* *"<<endl;break;case 5:cout<<"* *\n *\n* *"<<endl;total+=4;break;case 6:cout<<"* *\n* *\n* *"<<endl;break;} cout<<"Die VI:"<<endl; switch(f){case 1:cout<<"\n *\n"<<endl;break;case 2:cout<<"*\n\n *"<<endl;break;case 3:cout<<"*\n *\n *"<<endl;total+=2;break;case 4:cout<<"* *\n* *"<<endl;break;case 5:cout<<"* *\n *\n* *"<<endl;total+=4;break;case 6:cout<<"* *\n* *\n* *"<<endl;break;} //end check cout<<"How many petals around the rose? "; cin>>guess; if (guess==total) { cout<<"Correct, there are "<<total<<" petals around the rose!"<<endl; system("pause"); } else { cout<<"Wrong, there are "<<total<<" petals around the rose."<<endl;; system("pause"); }
} int main() { int menu=0; while (menu!=3) { menu=0; system("cls"); system("color 4"); cout<<"Petals Around the Rose"<<endl; cout<<"Made by GameHawk"<<endl; cout<<"---"<<endl; cout<<"1. Play"<<endl; cout<<"2. Help"<<endl; cout<<"3. Exit"<<endl; cout<<"---"<<endl; cin>>menu; if (menu==1) { game(); } if (menu==2) { help(); } } }
|
I hope you like it, PS you need windows to use it. I compiled it in Dev-C++ version 4.9.8.0
Enjoy,
gamehawk
--------------------
 ----- Last Updated: October 23, 2006
|
|
|
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
|