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.

Newcomers DBPro Corner / Rock Paper Scissors Game

Author
Message
Newbie Guy
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 4th Feb 2006 00:12
Does anyone have the code for Rock Paper Scissors game for Dark Basic?
Flaming Ghost
19
Years of Service
User Offline
Joined: 29th Apr 2005
Location: Um...Right here
Posted: 4th Feb 2006 16:38
You know, I seriously doubt that anyone will just give you code... you need to try it on your own first, then we will help you fix it if it has any problems.


LIGHT FRENZY (almost done!)
Best Noobish game ever.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 4th Feb 2006 22:29
Yeah we don't like the "Gimmie da codez!" messages. We can break it down for him though.

You can pick 2 random numbers between 0 and 2 (look up the "rnd" in the help files). Make 0=Rock, 1=Paper, and 2=Scissors. Make if/then statements (look up "if" in the help files) that check the number player1 has vs the number player2 has to determine who won. And add to the score of whoever won. And of course print the results to the screen (look up "print" or "text" in the help files).


Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 5th Feb 2006 06:06
Try to learn how this works.



Insanity is just a state of mind
Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 5th Feb 2006 06:39
well, when this thread hit, i went to make one just for the heck of it:



it's another approach. nearly the same amount of code as Daemon's. point is, learn from both sets of code, as well as the fact that there are different approaches to a situation when coding. good luck

Athlon XP1800+, Windows XP+SP2, Soyo K7V Dragon+ MB, 1.5Gb 333 RAM, ATI Radeon 8700LT (128Mb)
Drivers and Updates Kept Current
Milky the purple crab
19
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 5th Feb 2006 06:43
Isn't there a command that makes it unneccasary(sorry for spelling) to type if "ROCK" or "Rock" or "rock"?

I don't fear pain.....I fear feeling it.
Milky the purple crab
19
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 5th Feb 2006 07:24 Edited at: 5th Feb 2006 08:00
I had a crack at it too i think i did okay for a first try.



i used virtual nomad's code as a basis. thanks virtual.

MILKY

I don't fear pain.....I fear feeling it.
Milky the purple crab
19
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 5th Feb 2006 07:34 Edited at: 5th Feb 2006 07:35
sorry i double posted

I don't fear pain.....I fear feeling it.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 5th Feb 2006 09:19
Mine was made at the time of the my first post in this thread but I didn't post it because I wrote "We don't like gimmie da codez messages!"... I guess it's ok to post it now.




Newbie Guy
18
Years of Service
User Offline
Joined: 3rd Feb 2006
Location:
Posted: 5th Feb 2006 19:43
Thanks everyone for your help. It will get me started on the right path. Sorry for not knowing all the rules. I am learning. Thanks again.
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 5th Feb 2006 20:10
I looked into it and yes, there is a way to make it so that you don't have to check Rock, rock, and ROCK. Here is my code with only that change.



Insanity is just a state of mind
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 5th Feb 2006 22:37
I always just add a line right after the input "choice$=upper$(choice$)"... that way you don't have to do the conversion everytime you want to check the string.


The Short One
18
Years of Service
User Offline
Joined: 2nd Feb 2006
Location:
Posted: 5th Feb 2006 22:46
thanx for your info

<img src ="www.danasoft.com/sig/TheShortOnesSign.jpg">
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 8th Feb 2006 21:38
I threw this together pretty quickly cuz' I had to go get my tonsels taken out, IT KILLS! omgz soo much pain!

Anyhoo here's teh c0d3z:


While making it I dsicovered something cool, there's actually a formula to figure out who wins the match. Too tired to explain but check the code out and you'll see what I mean, it could've been written a lot more efficiently but im tired and in severe pain so thats all yer getin!

- RUC'

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 9th Feb 2006 00:55 Edited at: 9th Feb 2006 00:56
k, now this little tangent's got my attention again. heh.

ruc, re: formula
i've been thinking there's a 'formula' in the game somewhere too but i still don't see it. is this where the key lies?


still looks like it's manually comparing the possible combinations and stating a winner like the other code in this thread. please explain when the pain subsides? (btw, hope you're feeling better soon)

since i'm so very new to DBPro i don't know if such a thing exists, but it would sure be nice to 'declare' something like this:

for situations like this. there's gotta be a way. anyone know or have an idea on how to simplify?

Athlon XP1800+, Windows XP+SP2, Soyo K7V Dragon+ MB, 1.5Gb 333 RAM, ATI Radeon 8700LT (128Mb)
Drivers and Updates Kept Current
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 9th Feb 2006 01:02
Thats the formula I was talking about yes, I guess its not that much of a formula but its like...

Rock Paper Scissors has a specific order, Paper beating rock, Scissors beating Paper, and Rock beating Scissors. Lets say Rock = 1, Paper = 2 and Scissors = 3. If I choose 1, and the other player chooeses 3, I should win since I've gotten rock and they've gotten scissors. You can detect this by checking if my choise is 2 less than their choice. The same goes for 1 less except opposite, so if I chose 1 (rock) and the cp chose 2(paper), they win, you can then check this by checking if one choice is one less than the other.

So..

If user's choice is 2 less than opponents choice, user wins.

If user's choice is 1 less than opponents choice, user loses.

If user's choice is equal to opponents choice, user ties.

This is faster comparing the numbers rather than converting the numbers to their objects and then doing double the amount of checks to see who beat who, as you basically have to check each object against each other possible object.


Im gona look into finding the ASCII value of the first letter, or something like that. If they have a certain order then I could come up with an even faster formula.

Anyhoo I'm going to go watch Kong first

- RUC'

x1b
20
Years of Service
User Offline
Joined: 19th Sep 2004
Location:
Posted: 9th Feb 2006 03:00 Edited at: 9th Feb 2006 03:01
Quote: "Yeah we don't like the "Gimmie da codez!" messages."


Ya! Thats right!! we like "gimmeh multiple varities of t3h c0d3z!" messages

not even going to bother with posting mine,now. everyone and their mother "gibbed teh codez"

- Do it, Do it Right, Do it right now..
Sonic 91 Software
19
Years of Service
User Offline
Joined: 19th Mar 2005
Location: In a Cryptic Crossworld!
Posted: 11th Feb 2006 15:20
Quote: "Location: Cyberspace "


why, oh WHY are sooo many of you based in cyberspace!? I mean, nit just in this forum, but in all the others too!

I am a Christian and I know that God loves me. That is what makes my life so great!
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 11th Feb 2006 16:39 Edited at: 11th Feb 2006 16:41
<edit>

I'm foreign.

Login to post a reply

Server time is: 2024-09-24 15:33:08
Your offset time is: 2024-09-24 15:33:08