Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / My First C++ Game: Rock Paper Scissors :D

Author
Message
Preston C
21
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 6th Oct 2003 01:48
Finally, my first C++ game, might be command line based, but who cares, special thanks to TCA for helping me fix the code!

http://nwg.dbpcommunity.com/forums/RPS.zip

Code is posted in the source box if you wanna take a look


Dark Basic Pro has arived! I can feel the power!
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 6th Oct 2003 06:44
Congrats ! Seems bug-free .

--Mouse: Famous (Avatarless) Fighting Furball

A very nice %it, indeed.
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 6th Oct 2003 09:07 Edited at: 6th Oct 2003 09:07
Hey NWC Omega, what IDe do you use?

I used to use Dev-C++ before I reformatted, but then after I reformatted, I went to download the version I had before (4.9.7.0), installed it and all, and it didn't work! The include directory didn't even have iostream (i mean really, not even iostream!). What do you use? If it's free, can you tell me so I can know where to get it?!

Thanks a bunch.

SW Games - www.freewebs.com/swgames

Yeah, I know, I only have one game. Yeah, I know it sucks. But I made it! Me!
Preston C
21
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 6th Oct 2003 14:30
I use Dev-C++ (I'd use my copy of Visual C++ 6.0, but it was only a trial ) Not sure why the include files werent included, did you download it off of www.bloodshed.net (I think thats it)?


Dark Basic Pro has arived! I can feel the power!
HZence
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location:
Posted: 6th Oct 2003 17:06
Yeah, I downloaded the latest version. It said something about a "Win16@" something else link error - what the hang does that mean?

SW Games - www.freewebs.com/swgames

Yeah, I know, I only have one game. Yeah, I know it sucks. But I made it! Me!
Ian T
22
Years of Service
User Offline
Joined: 12th Sep 2002
Location: Around
Posted: 6th Oct 2003 19:57
I'd ask their technical support

--Mouse: Famous (Avatarless) Fighting Furball

A very nice %it, indeed.
Preston C
21
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 6th Oct 2003 23:45
Hmm, you got the latest version?

Note to Self: Do Not Upgrade Dev-C++


Dark Basic Pro has arived! I can feel the power!
MushroomHead
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 6th Oct 2003 23:53 Edited at: 6th Oct 2003 23:53
Quote: " downloaded the latest version. It said something about a "Win16@" something else link error - what the hang does that mean?"


It's linking to WinMain which doesn't exist (I assume you created a standard Win32 project and not a console proj). WinMain is something like this

Preston C
21
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 8th Oct 2003 04:18 Edited at: 8th Oct 2003 04:20
Updated the Game

It loops now, and the source is completely organized. I'll upload the exe later.

Edit: Gaah, why cant you edit the source I'll post it here:




Wik
21
Years of Service
User Offline
Joined: 21st May 2003
Location: CT, United States
Posted: 8th Oct 2003 04:40
I entered rock about 500 times and the computer kept doing rock.

Then I chose paper and...Wha'd ya know! I won

The computer did rock every time

The rock has rolled!
Preston C
21
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 8th Oct 2003 04:48
I'll have to fix that for the next update.


Wiggett
21
Years of Service
User Offline
Joined: 31st May 2003
Location: Australia
Posted: 8th Oct 2003 05:23 Edited at: 8th Oct 2003 05:24
to make it choose random each time cant you just say a#= random(3)
then have if a#= 1 then show sprite rock, if 2 then paper, if 3 than scissors etc and run it from there?

[edit] oh wait , not in db is it. still im sure c++ would have similar functions?

Preston C
21
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 8th Oct 2003 14:26
No, I'm going to make the random number limit higher (300) and depending on where it is, the final number =1 2 or 3


Preston C
21
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 9th Oct 2003 05:11 Edited at: 9th Oct 2003 05:12
New Code and Download

http://nwg.dbpcommunity.com/forums/RPS2.zip




Martyn Pittuck
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 9th Oct 2003 13:57
you reseeded the random number generator?

Web Design Starting from $200. Special limited offer. MSN or Email me for more information.
Preston C
21
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 9th Oct 2003 14:30 Edited at: 9th Oct 2003 14:35
No, I increased the amount it could generate a random number for.

Last time, it was only 3, and just determined it.

Now, its 30.

<=10 computerenter=1 (Rock)
>10 and <=20 computerenter=2 (Paper)
>20 and <=30 computerenter=3 (Scissors)

Chances of you fighting the same style over and over are slightly reduced, but remember, in rock paper scissors, you only got 3 moves


Login to post a reply

Server time is: 2024-11-24 01:12:06
Your offset time is: 2024-11-24 01:12:06