The SilverCreator Plaza
Home Help Search Login RegisterCurrent time:  

Page Index Toggle Pages: 1
Send Topic Print
Rock Paper Scissors (Read 672 times)
BigPixel Chris
God Member
*****
Offline


Lose Ctrl. Gain Cmd. Get
a Mac.

Posts: 1111
Gender: male
Rock Paper Scissors
Nov 27th, 2006 at 1:56pm
 
First post in new board!

It's a bit crappy and old, but here is a simple Rock Paper Scissors game:

http://bigpixel.macintoshdevelopers.net/software/info/rps.html
Back to top
« Last Edit: Nov 27th, 2006 at 1:58pm by BigPixel Chris »  
WWW  
IP Logged
 
Hendo
God Member
*****
Offline


OH HAI! Wut r goin on
in this forum?

Posts: 1275
Ontario, Canada
Gender: male
Re: Rock Paper Scissors
Reply #1 - Dec 10th, 2006 at 3:57pm
 
i also remade this in Applescript.
Code:
set user_score to 0
set cpu_score to 0
repeat
set rps_list to {"Rock", "Paper", "Scissors"}
set the list_count to the count of rps_list
set pick to random number from 1 to list_count
set cpu_choice to item pick of rps_list as string
set rps_dialog to display dialog "Rock, Paper, Scissors?" buttons {"Rock", "Paper", "Scissors"}
set user_choice to (button returned of rps_dialog) as string
display dialog "Rock..." giving up after 1
display dialog "Paper..." giving up after 1
display dialog "Scissors!" giving up after 1
if user_choice is equal to cpu_choice then
display dialog "Player chose: " & user_choice & return & "Computer chose: " & cpu_choice & return & return & "Tie Game"
else if user_choice is equal to "Rock" and cpu_choice is equal to "Paper" then
display dialog "Player chose: " & user_choice & return & "Computer chose: " & cpu_choice & return & return & "You lose!"
set cpu_score to cpu_score + 1
else if user_choice is equal to "Rock" and cpu_choice is equal to "Scissors" then
display dialog "Player chose: " & user_choice & return & "Computer chose: " & cpu_choice & return & return & "You win!"
set user_score to user_score + 1
else if user_choice is equal to "Paper" and cpu_choice is equal to "Scissors" then
display dialog "Player chose: " & user_choice & return & "Computer chose: " & cpu_choice & return & return & "You lose!"
set cpu_score to cpu_score + 1
else if user_choice is equal to "Paper" and cpu_choice is equal to "Rock" then
display dialog "Player chose: " & user_choice & return & "Computer chose: " & cpu_choice & return & return & "You win!"
set user_score to user_score + 1
else if user_choice is equal to "Scissors" and cpu_choice is equal to "Rock" then
display dialog "Player chose: " & user_choice & return & "Computer chose: " & cpu_choice & return & return & "You lose!"
set cpu_score to cpu_score + 1
else if user_choice is equal to "Scissors" and cpu_choice is equal to "Paper" then
display dialog "Player chose: " & user_choice & return & "Computer chose: " & cpu_choice & return & return & "You win!"
set user_score to user_score + 1
end if
set play_again to display dialog "Play again?" buttons {"Yes", "No"}
set again_choice to button returned of play_again
if again_choice is not equal to "Yes" then
if user_score is greater than cpu_score then
display dialog "Final Score" & return & "You: " & user_score & return & "Computer: " & cpu_score & return & "You are the winner!"
exit repeat
else if user_score is less than cpu_score then
display dialog "Final Score" & return & "You: " & user_score & return & "Computer: " & cpu_score & return & "You are the loser!"
exit repeat
else if user_score is equal to cpu_score then
display dialog "Final Score" & return & "You: " & user_score & return & "Computer: " & cpu_score & return & "Looks like a tie game!"
exit repeat
end if
end if
end repeat


as you can see its a bit longer then my applescript coinflip:P
Back to top
 

...
WWW  
IP Logged
 
Xiphos
Full Member
***
Offline


This is my personal text!

Posts: 158
Re: Rock Paper Scissors
Reply #2 - Jul 15th, 2008 at 11:09am
 
it's cool
Back to top
 

2.33 GHz Intel Core 2 Duo
10.6.1
WWW  
IP Logged
 
John Jakovs
Senior Member
****
Offline


In Soviet Russia, YaBB
2.4 loves you!

Posts: 309
Gender: male
Re: Rock Paper Scissors
Reply #3 - Jan 3rd, 2009 at 4:33pm
 
LET x = RANDOM(2)
IF x = 1 THEN
LET side = tails
ELSE
LET side = heads
END IF

The quintessential and hallmark 6 lines of SC style programming
Back to top
 

...
 
IP Logged
 
Harry Caray
God Member
*****
Offline


What's your favorite planet?

Posts: 1213
Gender: male
Re: Rock Paper Scissors
Reply #4 - Jan 3rd, 2009 at 10:54pm
 
John Jakovs wrote on Jan 3rd, 2009 at 4:33pm:
LET x = RANDOM(2)
IF x = 1 THEN
LET side = tails
ELSE
LET side = heads
END IF


That code fails. The variable "side" is a numeric variable and can't be set to "heads" or "tails", it will only assume the value of 0.
Back to top
« Last Edit: Jan 3rd, 2009 at 10:55pm by Harry Caray »  

Visit my site Click Here&&...
WWW  
IP Logged
 
KungFuFurby AKA Furby2010
Senior Member
****
Offline


An outdated member that
really exists only =>
2005

Posts: 429
Re: Rock Paper Scissors
Reply #5 - Jan 4th, 2009 at 9:08am
 
Let's modify it to this... to ensure it works.

LET x = RANDOM(2)
IF x = 1 THEN
LET side$ = "tails"
ELSE
LET side$ = "heads"
END IF

That should fix any problems.
Back to top
« Last Edit: Jan 4th, 2009 at 9:08am by KungFuFurby AKA Furby2010 »  

This furby is active starting 2005. His company is called Kung Fu Furby Industries.
If you're thinking about developing a game, I'll get going on that right away! It'll take a while, but I can get the job done on the coding, execpt for network programming.
Projects:
Kung Fu Furby: The Game (abandoned)
Hunt For The Furby (currently out of the way)
SNET The Game

I am running a PowerMac G5 running Mac OS X 10.4.11.
WWW  
IP Logged
 
EqwanoX
God Member
*****
Offline



Posts: 1782
Gender: male
Re: Rock Paper Scissors
Reply #6 - Jan 4th, 2009 at 1:36pm
 
5 lines

let side$="heads"
let x=random(2)
if x=1 then
let side$="tails"
end if
Back to top
 

...
macintosh 8500/150 OS8.0
 
IP Logged
 
Hendo
God Member
*****
Offline


OH HAI! Wut r goin on
in this forum?

Posts: 1275
Ontario, Canada
Gender: male
Re: Rock Paper Scissors
Reply #7 - Jan 4th, 2009 at 1:39pm
 
One line in applescript Wink

Code:
display dialog (some item of {"Heads", "Tails"} 

Back to top
 

...
WWW  
IP Logged
 
WarHampster
Senior Member
****
Offline


Ghost is Close

Posts: 339
Gender: male
Re: Rock Paper Scissors
Reply #8 - Jan 4th, 2009 at 4:14pm
 
xD, thats some complicated programming.
Back to top
 

...

OS X Version 10.4.11, 2 GHz Intel Core 2 Duo
The+WarHampster  
IP Logged
 
EqwanoX
God Member
*****
Offline



Posts: 1782
Gender: male
Re: Rock Paper Scissors
Reply #9 - Jan 5th, 2009 at 9:19am
 
lololloolol "programing"
Back to top
 

...
macintosh 8500/150 OS8.0
 
IP Logged
 
WarHampster
Senior Member
****
Offline


Ghost is Close

Posts: 339
Gender: male
Re: Rock Paper Scissors
Reply #10 - Jan 5th, 2009 at 11:15am
 
Correction:

xD, thats a complicated single line script
Back to top
 

...

OS X Version 10.4.11, 2 GHz Intel Core 2 Duo
The+WarHampster  
IP Logged
 
Telstar5
God Member
*****
Offline


only found your laser
beams

Posts: 2025
Gender: male
Re: Rock Paper Scissors
Reply #11 - Jan 20th, 2009 at 7:07am
 
Does anyone remember the original thread for the coin flipping game? Kiss
Back to top
 

...
we're all sent here in different packages
to get revamped
once more
to get sent back in nicer packages
than the package before
and when we've learned
all that there is to learn
our postage won't have to be
addressed; return...
WWW telstarcontrol  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print