This skin was created by Rocky of the IF Skin Zone

InvisionFree - Free Forum Hosting
Create a free forum in seconds.

Learn More · Register for Free
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:

Name:   Password:


 

 Petals Around The Rose, A Neat Dice/Logic Game!
gamehawk
Posted: Dec 24 2005, 02:50 PM


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


--------------------
user posted image
-----
Last Updated: October 23, 2006
Top
Neken
Posted: Dec 24 2005, 03:27 PM


DirectX Guru


Group: Global Moderators
Posts: 515
Member No.: 11
Joined: 24-September 05



there's some things to improve in it .. and you don't seem to follow any standards of indentation ... huh.gif


--------------------
Top
gamehawk
Posted: Dec 24 2005, 03:30 PM


Master Member


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



Yeah, that's true I wast too lazy tongue.gif. It was a quick game took me all of 15 minutes.


--------------------
user posted image
-----
Last Updated: October 23, 2006
Top
gamehawk
Posted: Dec 24 2005, 03:30 PM


Master Member


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



Did you solve the puzzle?


--------------------
user posted image
-----
Last Updated: October 23, 2006
Top
BGamed
Posted: Jan 3 2006, 10:55 PM


Elite Member


Group: Members
Posts: 260
Member No.: 24
Joined: 29-December 05



nope...

I'm not even sure how the game works:

is it like this:

you've got to find the formule between the dices? sad.gif


--------------------
user posted imageuser posted image
Top
gamehawk
Posted: Jan 3 2006, 11:31 PM


Master Member


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



There's a formula all right! Once you find it, count up the number of dots that go along with the formula and whoila.


--------------------
user posted image
-----
Last Updated: October 23, 2006
Top
BGamed
Posted: Jan 4 2006, 10:38 AM


Elite Member


Group: Members
Posts: 260
Member No.: 24
Joined: 29-December 05



okay...thats what I thought...

But it is too difficult for me tongue.gif


--------------------
user posted imageuser posted image
Top
gamehawk
Posted: Jan 4 2006, 09:27 PM


Master Member


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



I'll tell you the solution, a die with a center has buds around it. Count the buds and add.


--------------------
user posted image
-----
Last Updated: October 23, 2006
Top
polar productions
Posted: Jun 11 2006, 06:14 AM


Advanced Member


Group: Members
Posts: 32
Member No.: 62
Joined: 26-January 06



Ya, I got this pretty easy. Actually, it was because my math teacher showed it to us with cards and called it Polar Bears around the Fishing hole. I figured that out pretty quick and he was pretty amazed... I just saw it immediatly. But this was pretty cool... I liked that it was red, now I can read your code and figure out how to change the colour!
Top
BGamed
Posted: Jun 11 2006, 11:41 AM


Elite Member


Group: Members
Posts: 260
Member No.: 24
Joined: 29-December 05



for color changing you need to do this:
CODE
system("color 0A");


you can replace the zero and the letter A
(A= bright green letters)
(0= black background)

the number always have to be before the letters...


--------------------
user posted imageuser posted image
Top
gamehawk
Posted: Jun 11 2006, 01:32 PM


Master Member


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



Thanks polar, glad you liked it. Do you want to learn some more C++, if so read some of the Classes and tutorials! Glad to see you posting somewhere other than off topic.

Cheers,

gamehawk smile.gif


--------------------
user posted image
-----
Last Updated: October 23, 2006
Top
polar productions
Posted: Jun 14 2006, 04:01 AM


Advanced Member


Group: Members
Posts: 32
Member No.: 62
Joined: 26-January 06



Ive actually learned quite a bit since the last time I was here. Well... second to last time. I feel pretty comfortable with classes and structures. I just cant really get the hang of pointers... and what header is System stuff under? I dont really have time to look around at the moment.
Top
DealsFor.me - The best sales, coupons, and discounts for you

Topic Options



Hosted for free by InvisionFree* (Terms of Use: Updated 2/10/2010) | Powered by Invision Power Board v1.3 Final © 2003 IPS, Inc.
Page creation time: 0.4852 seconds | Archive