Board Logo
« Rock, Paper, Scissors game »

Welcome Guest. Please Login or Register.
Jan 21st, 2018, 12:50am


Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Please use the forums Search feature before asking.
Please post code using the code box described in Format Your Messages.
This will keep indentation, separate it better form the message and prevent gibberish.
If the code is too long for one post or additional files are needed, upload a ZIP archive to the Just BASIC Files Archive Site.

« Previous Topic | Next Topic »
Pages: 1 2 3  Notify Send Topic Print
 veryhotthread  Author  Topic: Rock, Paper, Scissors game  (Read 1955 times)
JohnJade
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 4
xx Rock, Paper, Scissors game
« Thread started on: Dec 4th, 2007, 02:54am »

Details:

You will input rock, paper and scissors and the program will tell you if that is your final answer. Then the program will automatically pick random variable: rock, paper and scissors and then tells the winner of the game. Lastly, the program will ask if you want to try again the game.

That's all!
grin
User IP Logged

timbim
Full Member
ImageImageImageImage


member is offline

Avatar

I can easily make you an avatar too!


PM

Gender: Male
Posts: 263
xx Re: Rock, Paper, Scissors game
« Reply #1 on: Dec 4th, 2007, 05:31am »

Code:
[s]
Input "Rock, Paper or Scisors? "; i$
select case upper$(left$(i$,1))
case "R"
s$ = "Rock"
case "P"
s$ = "Paper"
case "S"
s$= "Scissors"
end select
print "Is ";s$;" your final answer?"
input "(Y/N)"; c$
if upper$(left$(c$,1)) = "Y" then [c] else [s]
[c]
p = rnd(1)
select case
case p > 0.3333333
cc$ = "Rock"
case p > 0.6666666
cc$ = "Paper"
case else
cc$ = "Scissors"
end select
if s$ = cc$ then r$ = "Draw"
if s$ = "Paper" and cc$ = "Rock" then r$ = "Player Wins"
if s$ = "Rock" and cc$ = "Paper" then r$ = "Computer Wins"
if s$ = "Paper" and cc$ = "Scissors" then r$ = "Computer Wins"
if s$ = "Scissors" and cc$ = "Paper" then r$ = "Player Wins"
if s$ = "Scissors" and cc$ = "Rock" then r$ = "Computer Wins"
if s$ = "Rock" and cc$ = "Scissors" then r$ = "Player Wins"
print r$
input "Play again?";p$
if upper$(left$(p$,1)) = "Y" then [s] else [q]
[q]
end
 
User IP Logged

Welopez
Moderator
ImageImageImageImageImage


member is offline

Avatar

Never let your beliefs get in the way of learning.


PM

Gender: Male
Posts: 4407
xx Re: Rock, Paper, Scissors game
« Reply #2 on: Dec 4th, 2007, 3:12pm »

Good job, timbim! I was considering using BMPBUTTONs for this program, since paper and scissor BMPs are included with the JB download... but darnit! I didn't want to upload a rock BMP, so I simply decided to go with regular buttons and a SELECT CASE for my program.
Code:
choice$="PAPER ROCK SCISSORS"
msg1$="Please make your selection:"
result$="Hooray, you WIN!| Sorry, the computer WINS!| That game is a DRAW."

NOMAINWIN

WindowWidth=400
WindowHeight=400
UpperLeftX=INT((DisplayWidth-WindowWidth)/2)
UpperLeftY=INT((DisplayHeight-WindowHeight)/2)

STATICTEXT #game.st1, msg1$, 20, 20, 370, 30
STATICTEXT #game.st2, "", 20, 190, 370, 30
STATICTEXT #game.st3, "", 20, 220, 370, 30
STATICTEXT #game.st4, "", 20, 250, 370, 30

BUTTON #game.btn1, "PAPER", [paper], UL, 130, 60, 140, 30
BUTTON #game.btn2, "ROCK", [rock], UL, 130, 100, 140, 30
BUTTON #game.btn3, "SCISSORS", [scissors], UL, 130, 140, 140, 30
BUTTON #game.btn4, "AGAIN?", [again], LL, 60, 0, 100, 30
BUTTON #game.btn5, "LEAVE", [quit], LL, 240, 0, 100, 30

OPEN "Paper/Rock/Scissors" FOR WINDOW AS #game
PRINT #game, "FONT verdana 12 bold"
PRINT #game, "trapclose [quit]"
[again]
PRINT #game.st2, ""
PRINT #game.st3, ""
PRINT #game.st4, ""
comp=INT(RND(0)*3)+1

WAIT
[paper]
PRINT #game.st2, "You chose PAPER."
plyr=1
PRINT #game.st3, "The computer chose "; WORD$(choice$,comp); "."
CALL result plyr, comp, res
PRINT #game.st4, WORD$(result$, res, "|")

WAIT
[rock]
PRINT #game.st2, "You chose ROCK."
plyr=2
PRINT #game.st3, "The computer chose "; WORD$(choice$, comp); "."
CALL result plyr, comp, res
PRINT #game.st4, WORD$(result$, res, "|")

WAIT
[scissors]
PRINT #game.st2, "You chose SCISSORS."
plyr=3
PRINT #game.st3, "The computer chose "; WORD$(choice$, comp); "."
CALL result plyr, comp, res
PRINT #game.st4, WORD$(result$, res, "|")


WAIT
[quit]
    CLOSE #game
    END
'res: 1=plyr wins; 2=comp wins; 3=draw
SUB result plyr, comp, byref res
SELECT CASE
CASE plyr=1 AND comp=1
    res=3
CASE plyr=1 AND comp=2
    res=1
CASE plyr=1 AND comp=3
    res=2
CASE plyr=2 AND comp=1
    res=2
CASE plyr=2 AND comp=2
    res=3
CASE plyr=2 AND comp=3
    res=1
CASE plyr=3 AND comp=1
    res=1
CASE plyr=3 AND comp=2
    res=2
CASE plyr=3 AND comp=3
    res=3
END SELECT
END SUB
 

The computer has not been programmed to cheat, but that doesn't mean I haven't made an error in logic when evaluating the plyr and comp selections. At my age, errors are more common than prescription medications.
User IP Logged

JB 1.01
Win7 64bit, 4 GB RAM, Pentium 6200@2.13 GHz (laptop)
WinXP, 1 GB RAM, Intel N270@1.6 GHz (netbook)
timbim
Full Member
ImageImageImageImage


member is offline

Avatar

I can easily make you an avatar too!


PM

Gender: Male
Posts: 263
xx Re: Rock, Paper, Scissors game
« Reply #3 on: Dec 4th, 2007, 3:23pm »

Well, I daresay I would have produced somtihing more sophisticated had I spent more than ten mins. on it. Mind you, this looks suspiciously like someone's homework...
User IP Logged

Welopez
Moderator
ImageImageImageImageImage


member is offline

Avatar

Never let your beliefs get in the way of learning.


PM

Gender: Male
Posts: 4407
xx Re: Rock, Paper, Scissors game
« Reply #4 on: Dec 4th, 2007, 3:37pm »

Quote:
You will input rock, paper and scissors...

Yes, it sounds exactly like a homework assignment for John. I hope he seriously reads all the posts in case his teacher asks, "What does this mean?" laugh

I goofed.... I did not include the "Are you sure that's what you want to do? You're not gonna change your mind? Is that your final answer?" Sorry, that sounds too much like one of those ridiculous game shows... or maybe Monte Hall trying to get you to give away whats behind door number two. laugh
User IP Logged

JB 1.01
Win7 64bit, 4 GB RAM, Pentium 6200@2.13 GHz (laptop)
WinXP, 1 GB RAM, Intel N270@1.6 GHz (netbook)
timbim
Full Member
ImageImageImageImage


member is offline

Avatar

I can easily make you an avatar too!


PM

Gender: Male
Posts: 263
xx Re: Rock, Paper, Scissors game
« Reply #5 on: Dec 5th, 2007, 02:27am »

Monte Hall? Well, I suppose I could name plenty of british hosts that you American crowd have never heard of...
User IP Logged

Henry
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 757
xx Re: Rock, Paper, Scissors game
« Reply #6 on: Dec 6th, 2007, 04:33am »

Here's my Rock-Paper-Scissors game. Written last year as programming practice. It has a YesNo$ function that's been reused in many programs. And it has a rather simple yet -- dare i say -- elegant method of determining the winner.
Code:
' r-p-s.bas (Rock - Paper - Scissors)
' original version from BASIC Computer Games - pg 137
' Just BASIC version - Dec 2006

  call showrules
  done = 0
  numgames = 100
  while done=0
    while numgames<0 or numgames>10
      print "  How many games would you like to play? (0-10): ";
      input numgames
    wend
    gm = 0
    points = 0
    while gm<numgames
      gm = gm + 1
      print "  ----------"
      print "  Game # "; gm
      points = points + play1game(gm)
      print
    wend
    print "  In "; numgames; " games, you earned "; points; " points."
    print "  The computer earned "; numgames-points; " points."
    print
    if YesNo$("  Play again? ")="n" then done = 1
  wend
  print
  print "  Ok.  Hope you had fun.  Bye."

END
' ===== End of Main Program =====

sub showrules
  print
  print ,"Rock - Paper - Scissors"
  print
  print "  This game is played against the computer.  "
  print "  You choose Rock, Paper or Scissors and so does the "
  print "  computer.  The winners are: Paper covers Rock, "
  print "  Scissors cut Paper, and Rock smashes Scissors. "
  print "  So each option can win, lose or tie (if both pick "
  print "  the same thing).  You get 1 point for a win and a "
  print "  half-point for a tie.  Good luck!"
  print
end sub

' sub to ask question and get 'yes' or 'no' answer
' returns "y" or "n"
function YesNo$(question$)
  done = 0
  while done=0
    print question$;
    input ""; ch$
    ch$ = trim$(lower$(left$(ch$,1)))
    if ch$="y" or ch$="n" then
      done = 1
    else
      print "  Eh?  Please answer 'Yes' or 'No'. "
    end if
  wend
  YesNo$ = ch$
end function  ' YesNo

' sub to play a single game. Returns the pt won by the player.
function play1game(n)
  picks$ = "Rock Paper Scissors"
' get player's choice (R, P, S)
  yerpick = 0
  while yerpick=0
    input "  Choose: (R)ock, (P)aper or (S)cissors: (R,P,S) ? "; ch$
    ch$ = trim$(lower$(left$(ch$,1)))
    yerpick = instr("rps", ch$, 1)
    if yerpick=0 then print " Please enter R, P or S."
  wend

' computer's choice
  mypick = int(rnd(1)*3) + 1

' show our picks
  print "  Your pick was    : "; word$(picks$, yerpick); "."
  print "  Computer pick was: "; word$(picks$, mypick); "."

' determine winner
  if yerpick=mypick then
    print "  Tie game.  No winner."
    point = 0.5
  else
    if yerpick+mypick=4 then  ' 1+3 or 3+1
      if yerpick=1 then yerpick = 4 else mypick = 4
    end if
    if yerpick>mypick then
      print "  You won!"
      point = 1
    else
      print "  I won!"
      point = 0
    end if
  end if
  play1game = point  ' win=1, tie=0.5, loss=0
end function  ' play1game 
User IP Logged

Mike1056
Junior Member
ImageImageImage


member is offline

Avatar




PM


Posts: 101
xx Re: Rock, Paper, Scissors game
« Reply #7 on: Dec 15th, 2007, 10:00pm »

For starter's, pick up "Programming for the Absolute Beginner" by Jerry Lee Ford, Jr. It has a rock, paper, scissors game in it. I've attached a quick version of one that I wrote that will work, but it's not as cool as the one in the book because A) I really think you should invest the $30 in the book (it's REALLY good, and you'll learn A LOT), and B) I've got a lot of things on my agenda for the day and am short on time. Anyway, here it goes...

'Rock, Paper, Scissors
[StartGame]
Cls
Print "Make your Selection"
Print "1 - Rock"
Print "2 - Paper"
Print "3 - Scissors"
Print
Input ">> "; Selection$

If Selection$ = "1" then Selection$ = "Rock"
If Selection$ = "2" then Selection$ = "Paper"
If Selection$ = "3" then Selection$ = "Scissors"

Computer = int(rnd(1)*3) + 1
If Computer = 1 then Computer$ = "Rock"
If Computer = 2 then Computer$ = "Paper"
If Computer = 3 then Computer$ = "Scissors"

If Selection$ = "Rock" and Computer$ = "Rock" then [Draw]
If Selection$ = "Rock" and Computer$ = "Paper" then [Lose]
If Selection$ = "Rock" and Computer$ = "Scissors" then [Win]

If Selection$ = "Paper" and Computer$ = "Rock" then [Win]
If Selection$ = "Paper" and Computer$ = "Paper" then [Draw]
If Selection$ = "Paper" and Computer$ = "Scissors" then [Lose]

If Selection$ = "Scissors" and Computer$ = "Rock" then [Lose]
If Selection$ = "Scissors" and Computer$ = "Paper" then [Win]
If Selection$ = "Scissors" and Computer$ = "Scissors" then [Draw] else [StartGame]

[Win]
Notice "You Win!"
Goto [PlayAgain]

[Lose]
Notice "You Lose!"
Goto [PlayAgain]

[Draw]
Notice "It was a Tie!"
Goto [PlayAgain]

[PlayAgain]
Cls
Input "Would you like to play again? (y/n) ";yn$
yn$ = upper$(yn$)
If yn$ = "Y" then [StartGame]
If yn$ = "N" then
Cls
Print "Thanks for playing! Good-bye!"
End
Else
Goto [PlayAgain]
End If
User IP Logged

JohnDavidson
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 4142
xx Re: Rock, Paper, Scissors game
« Reply #8 on: Dec 16th, 2007, 11:11am »

Mike1056's code modified a little:

Code:
 'Rock, Paper, Scissors
[StartGame]
    Cls

'------------- User select -----------

    Print "Make your Selection"
    Print "1 - Rock"
    Print "2 - Paper"
    Print "3 - Scissors"
    Print
    Input ">> "; you$


'---------- Computer select ----------
    Computer = int(rnd(1)*3) + 1


'--------- Determine winner ----------
    select case you$
    case "1"
         Selection$ = "Rock"
        if Computer=2 then winner=1 else winner=2
    case "2"
        Selection$ = "Paper"
        if Computer=3 then winner=1 else winner=2
    case "3"
        Selection$ = "Scissors"
        if Computer=1 then winner=1 else winner=2
    case else
        notice "Input error"
        goto [StartGame]
    end select

    if val(you$)=Computer then winner=3


'---------- Display results ----------
    print "You chose ";Selection$;
    select case Computer
    case 1
        print ", I chose Rock."
    case 2
        print ", I chose Paper."
    case 3
        print ", I chose Scissors."
    end select

    select case winner
    case 1
        print "I win!"
        iWin=iWin+1
    case 2
         print "You win!"
         uWin=uWin+1
    case 3
        print "It's a draw!"
        aDraw=aDraw+1
    end select
'-------------------------------------

    print
    Input "Would you like to play again? (y/n) ";yn$
    if upper$(yn$)<>"N" then [StartGame]


'-------- Close out the game ---------
    Cls
    totalPlay=iWin + uWin + aDraw
    print "We played ";totalPlay;" times."
    print "You won ";uWin;" times and I won ";iWin;" times."
    print
    print aDraw;" times we both chose the same thing."
    print
    Print "Thanks for playing! Good-bye!"
    End 




User IP Logged

John Davidson
e-me: johnshomeport@yahoo.com
My JB Page: http://john.jbusers.com/
Did ya Libby yet? http://lblibby.com/
Henry
Senior Member
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 757
xx Re: Rock, Paper, Scissors game
« Reply #9 on: Dec 23rd, 2007, 05:18am »

I came up with an even easier way to determine the winner.
Code:
' show our picks
  print "  Your pick was    : "; word$(picks$, yerpick); "."
  print "  Computer pick was: "; word$(picks$, mypick); "."

' determine winner
  if yerpick*mypick=3 then  ' 1&3 or 3&1
      if yerpick=1 then yerpick = 4 else mypick = 4
  end if
  point = (yerpick - mypick + 1)/2
  select case point
    case 0  : print "You lose."
    case 0.5: print "Tie game."
    case 1  : print "You win!"
  end select
 
User IP Logged

Welopez
Moderator
ImageImageImageImageImage


member is offline

Avatar

Never let your beliefs get in the way of learning.


PM

Gender: Male
Posts: 4407
xx Re: Rock, Paper, Scissors game
« Reply #10 on: Dec 23rd, 2007, 08:26am »

Simple and slick, Henry! Very creative! Good thinking!
User IP Logged

JB 1.01
Win7 64bit, 4 GB RAM, Pentium 6200@2.13 GHz (laptop)
WinXP, 1 GB RAM, Intel N270@1.6 GHz (netbook)
StrongTower
Member in Training
ImageImage


member is offline

Avatar

No one is greater than God!


PM

Gender: Male
Posts: 36
xx Re: Rock, Paper, Scissors game
« Reply #11 on: Dec 24th, 2007, 8:42pm »

Code:
print "[R]ock, [P]aper, [S]cissors"

input s$
select case s$
   case "R"
      se$ = "Rock"
   case "P"
      se$ = "Paper"
   case "S"
      se$ = "Scissors"
end select

i = int(rnd(1)*3) + 1
if i = 1 then pc$ = "Rock"
if i = 2 then pc$ = "Paper"
if i = 3 then pc$ = "Scissors"

if rps$(se$, pc$) = "User" then
   print "User won!"

 else
   print "PC won!"

end if

end


function rps$(u$, c$)
   if u$ = C$ then
      print u$;" and ";c$;" is a tie"
   end if
   if u$ <> c$ then
      if u$ = "Rock" and c$ = "Paper" then
         print c$;" Won"
          rps$ = "PC"
      end if
      if u$ = "Paper" and c$ = "Scissors" then
        print c$;" Won"
rps$ = "PC"
      end if
      if u$ = "Scissors" and c$ = "Rock" then
        print c$;" Won"
rps$ = "PC"
      end if

      if u$ = "Paper" and c$ = "Rock" then
         print u$;" Won "
          rps$ = "User"
      end if
      if u$ = "Scissors" and c$ = "Paper" then
         print u$;" Won"
          rps$ = "User"
      end if
      if u$ = "Rock" and c$ = "Scissors" then
         print u$;" Won"
          rps$ = "User"
      end if

   end if

end function
 


Here is mine. I just use the function command because it seems so easyer todo.
« Last Edit: Dec 24th, 2007, 8:43pm by StrongTower » User IP Logged

JB/LB Programmer at work!



God Bless All!
b
Member in Training
ImageImage


member is offline

Avatar

Thank you for calling our tech support line! Approximate wait time is: 20 years


PM


Posts: 69
xx Re: Rock, Paper, Scissors game
« Reply #12 on: Dec 30th, 2007, 11:34pm »

Here is my entry. You don't have to click the new game button or the pick button.
Code:
'RPS Program for Contest
'(c) 2007 B

[start]
dim choices$(2)
choices$(0) = "Rock"
choices$(1) = "Paper"
choices$(2) = "Scissors"
wins = 0
loses = 0
draws = 0
youpick = 0
computerpick = 0
[openwin]
    nomainwin

    WindowWidth = 720
    WindowHeight = 450

    UpperLeftX=int((DisplayWidth-WindowWidth)/2)
    UpperLeftY=int((DisplayHeight-WindowHeight)/2)

    statictext #main.statictext1, "Wins", 62, 31, 48, 20
    statictext #main.statictext2, "Draws", 334, 31, 144, 20
    statictext #main.statictext3, "Loses", 606, 31, 144, 20
    textbox #main.wins, 54, 61, 56, 25
    textbox #main.draws, 326, 61, 56, 25
    textbox #main.loses, 598, 61, 56, 25
    statictext #main.statictext7, "Your Pick", 118, 176, 144, 20
    statictext #main.statictext8, "Computer's Pick", 438, 176, 144, 20
    combobox #main.you, choices$(, [youpick], 94, 216, 120, 100
    button #main.pick, "Pick", [youpick], UL, 94, 261, 122, 25
    textbox #main.computer, 438, 216, 120, 25
    statictext #main.statictext12, "Status:", 318, 311, 144, 20
    textbox #main.status, 238, 336, 208, 25
    button #main.button14, "New Game", [newgame], UL, 150, 376, 122, 25
    button #main.button15, "Reset", [reset], UL, 406, 376, 122, 25
    open "Rock, Paper, Scissors Game" for window as #main
    print #main, "trapclose [quit.main]"

    print #main, "font ms_sans_serif 10"
    print #main.statictext1, "!font MS_Sans_Serif 10 bold"
    print #main.statictext2, "!font MS_Sans_Serif 10 bold"
    print #main.statictext3, "!font MS_Sans_Serif 10 bold"
    print #main.statictext7, "!font MS_Sans_Serif 10 bold"
    print #main.statictext8, "!font MS_Sans_Serif 10 bold"

print #main.wins, STR$(wins)
print #main.draws, STR$(draws)
print #main.loses, STR$(loses)
print #main.status, ""

    wait

[quit.main]
    Close #main
    END


[youpick]    'Perform action for the combobox named 'you'
print #main.you, "selectionindex? index"
if index = 0 then notice "Please choose Rock, Paper, or Scissor." : wait
youpick = index - 1
'Computer Picks
[computerpick]
pickc = int(rnd(1)*30)
if pickc > 0 and pickc < 11 then computerpick = 0
if pickc > 10 and pickc < 21 then computerpick = 1
if pickc > 20 and pickc < 31 then computerpick = 2
for i = 1 to 1900
print #main.computer, "Rock"
print #main.computer, "Paper"
print #main.computer, "Scissor"
next i
print #main.computer, "";choices$(computerpick);""

if youpick = computerpick then goto [draw]
'You picked 0
if youpick = 0 and computerpick = 1 then goto [lose]
if youpick = 0 and computerpick = 2 then goto [win]
'You picked 1
if youpick = 1 and computerpick = 0 then goto [win]
if youpick = 1 and computerpick = 2 then goto [lose]
'You picked 2
if youpick = 2 and computerpick = 0 then goto [lose]
if youpick = 2 and computerpick = 1 then goto [win]

[win]
wins = wins + 1
print #main.status, "You Won!!!"
print #main.wins, STR$(wins)
wait
[lose]
loses = loses + 1
print #main.status, "The Computer Won."
print #main.loses, STR$(loses)
wait
[draw]
draws = draws + 1
print #main.status, "Draw."
print #main.draws, STR$(draws)
wait
[newgame]    'Perform action for the button named 'button14'
   close #main
   goto [openwin]
[reset]    'Perform action for the button named 'button15'
    close #main
    goto [start]
 

B
User IP Logged

Welopez
Moderator
ImageImageImageImageImage


member is offline

Avatar

Never let your beliefs get in the way of learning.


PM

Gender: Male
Posts: 4407
xx Re: Rock, Paper, Scissors game
« Reply #13 on: Dec 31st, 2007, 07:32am »

Very nice entry, b. You can simplify your font settings:
Code:
    print #main, "font arial 10 bold"
'    print #main.statictext1, "!font MS_Sans_Serif 10 bold"
'    print #main.statictext2, "!font MS_Sans_Serif 10 bold"
'    print #main.statictext3, "!font MS_Sans_Serif 10 bold"
'    print #main.statictext7, "!font MS_Sans_Serif 10 bold"
'    print #main.statictext8, "!font MS_Sans_Serif 10 bold"
 

The first PRINT #main, "FONT arial 10 bold" sets the font for all controls on the GUI. You could set the font for statictexts individually if you want them to be different.

Good job!
User IP Logged

JB 1.01
Win7 64bit, 4 GB RAM, Pentium 6200@2.13 GHz (laptop)
WinXP, 1 GB RAM, Intel N270@1.6 GHz (netbook)
Crusader
Senior Member
ImageImageImageImageImage


member is offline

Avatar

"love is the red the rose on your coffin door"

YIM YIM AIM
Homepage PM

Gender: Male
Posts: 581
xx Re: Rock, Paper, Scissors game
« Reply #14 on: Dec 31st, 2007, 2:04pm »


help! nothing happens on my computer when you hit the button!??! it should work

Code:
'paper beats rock
'rock beats scissor
'scissor beats paper

'rock is 1
'paper is 2
'scissors is 3
    nomainwin

    WindowWidth = 235
    WindowHeight = 172

    button #main.p, "Paper", [p], UL, 26, 16, 70, 27
    button #main.s, "Scissor", [s], UL, 26, 52, 70, 27
    button #main.r, "Rock", [r], UL, 26, 85, 70, 27
    statictext #main.statictext4, "Press A 'Wepon' Type to attack.", 27, 118, 248, 20

    open "Rock Paper Scissors" for window as #main
    print #main, "font ms_sans_serif 0 16"


[main]
    wait


[p]
player$="Paper"
npc = (rnd(1)*3)
if npc = 3 then goto [lose]
if npc = 1 then goto [win]

    wait

[s]
player$="Scissors"
npc = (rnd(1)*3)
if npc = 1 then goto [lose]
if npc = 2 then goto [win]
    wait


[r]
player$="Rock"
npc = (rnd(1)*3)
if npc = 2 then goto [lose]
if npc = 3 then goto [win]
    wait



[lose]
if npc = 1 then npc$ = "rock"
if npc = 2 then npc$ = "paper"
if npc = 3 then npc$ = "scissors"

 notice "You Picked";player$;" they picked";npc$
 notice "You Lose :'( Try Again."

 goto [main]

[win]
 notice "You Picked";player$;" they picked";npc$
if npc = 1 then npc$ = "rock"
if npc = 2 then npc$ = "paper"
if npc = 3 then npc$ = "scissors"

notice "You Win :) Good Job!"
goto [main]
 
User IP Logged

Mutant Turkey Talk

Pages: 1 2 3  Notify Send Topic Print
« Previous Topic | Next Topic »

Conforums Terms of Service | Membership Rules | Home | Search | Recent Posts | Notification | Format Your Message | Installation FAQ

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls