
-----------------------------------
hossack
Fri May 16, 2008 8:20 pm

Quick Loop Question
-----------------------------------
is there a way to restart a Loop without using an reposting the whole loop inside the loop inside an if statement. In my program i have an if statement asking to play again and if they hit "y" then it suppossed to play again but i didn't want to post the whole loop inside it again. Is there another way?

-----------------------------------
cavetroll
Fri May 16, 2008 8:33 pm

RE:Quick Loop Question
-----------------------------------
You could put the loop in a procedure and call the procedure if they respond with "y"

-----------------------------------
hossack
Fri May 16, 2008 8:48 pm

RE:Quick Loop Question
-----------------------------------
how do i do that?

-----------------------------------
gitoxa
Fri May 16, 2008 8:51 pm

RE:Quick Loop Question
-----------------------------------
or, you could just exit the loop when they enter n

-----------------------------------
hossack
Fri May 16, 2008 8:54 pm

RE:Quick Loop Question
-----------------------------------
it does do that i want it to restart when they enter y without posting the loop again inside an if statement

-----------------------------------
gitoxa
Fri May 16, 2008 9:05 pm

RE:Quick Loop Question
-----------------------------------
You only exit if they type in n.  If they type in y, then it'll loop back up to the top again.  You don't need any if statements.

loop
    %Does stuffs here
    %More stuff, for lulz
    put "Would you like ot play again?"
    get Answer
    exit when Answer = "n"
end loop

-----------------------------------
hossack
Fri May 16, 2008 9:10 pm

RE:Quick Loop Question
-----------------------------------
i did that and the program doesnt restart to the starting of the loop

-----------------------------------
cavetroll
Fri May 16, 2008 9:11 pm

RE:Quick Loop Question
-----------------------------------
Yup, you're right. I over thought that one way too much. Been learning about procedures in school so I'm used to using them to solve all problems.

-----------------------------------
hossack
Fri May 16, 2008 9:17 pm

RE:Quick Loop Question
-----------------------------------
so im pretty much stuck doing it the really long way?

-----------------------------------
gitoxa
Fri May 16, 2008 9:18 pm

RE:Quick Loop Question
-----------------------------------
No, it means you've screwed up your code.


Mod edit: Let's keep away from the swear words.

-----------------------------------
hossack
Fri May 16, 2008 9:20 pm

RE:Quick Loop Question
-----------------------------------
damn it.. lol everything works just not the play again thing

-----------------------------------
gitoxa
Fri May 16, 2008 9:23 pm

RE:Quick Loop Question
-----------------------------------
Then re-do the exit part.  Post what you have if you can't get it still.

-----------------------------------
hossack
Fri May 16, 2008 9:26 pm

RE:Quick Loop Question
-----------------------------------
post my whole program or just he exit part?

-----------------------------------
hossack
Fri May 16, 2008 9:30 pm

Re: Quick Loop Question
-----------------------------------
xvar rock, paper, scissors, rules : int
var x, y, buttonnumber, buttonup, WinID : int
var answer : string
var key : string (1)
var userchoice, compchoice : int
var win, lose, tie : int := 0

process domusic
    Music.PlayFileLoop ("daft punk - musique.mp3")
end domusic

randomize

fork domusic
drawfill (1, 1, 102, 102) %Filling in Backround
locatexy (200, 280) %locating Rock, Paper, Scissors
colorback (102)
put "Welcome to Ryan's Rock, Paper, Scissors Game!"

rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
Pic.Draw (rock, 10, 10, picCopy)

paper := Pic.FileNew ("paper.bmp") %Inserting Paper Image
Pic.Draw (paper, 190, 10, picCopy)

scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
Pic.Draw (scissors, 380, 16, picCopy)

locatexy (500, 1)
put "By Ryan Hossack"

locatexy (1, 1) %Clicking to go to next page
put "click to continue"
buttonwait ("down", x, y, buttonnumber, buttonup)
if x > 0 and x < 640 and y > 0 and y < 400 then
    cls
end if

rules := Pic.FileNew ("scissorDM_468x389.bmp") %Putting in Picture for Rules
Pic.Draw (rules, 100, 5, picCopy)

locatexy (1, 1) %Clicking to go to next page
put "click to continue"
buttonwait ("down", x, y, buttonnumber, buttonup)
if x > 0 and x < 640 and y > 0 and y < 400 then
    cls
end if


locatexy (280, 300)
put "Pick Rock, Paper, or Scissors"
rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
Pic.Draw (rock, 10, 10, picCopy)

paper := Pic.FileNew ("paper.bmp") %Inserting Paper Image
Pic.Draw (paper, 190, 10, picCopy)

scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
Pic.Draw (scissors, 380, 16, picCopy)


loop
    buttonwait ("down", x, y, buttonnumber, buttonup)
    if x > 10 and x < 170 and y > 10 and y < 280 then %If choose Rock
        userchoice := 1
        randint (compchoice, 1, 3) %Computer Choosing

        if userchoice = 1 and compchoice = 3 then     %If computer chooses scissors then win
            delay (10)
            cls
            put "You Chose Rock"
            rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
            Pic.Draw (rock, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
            Pic.Draw (scissors, 380, 16, picCopy)
            locatexy (320, 280) %Saying You Won
            put "You Won" ..
            win := win + 1
            locatexy (300, 200) %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
            locatexy (1, 350)
            put "Play again? y or n"
            get answer
            exit when answer = "n"
  
            
        elsif userchoice = 1 and compchoice = 2 then     %If computer chooses Paper then lose
            cls
            put "You chose Rock"
            rock := Pic.FileNew ("rock.bmp")     %Inserting Rock Image
            Pic.Draw (rock, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 380, 10, picCopy)
            delay (100)
            locatexy (320, 280)     %Saying You Lost
            put "You Lost" ..
            lose := lose + 1
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..

        elsif userchoice = compchoice then     %If computer chooses Rock then tie
            cls
            put "You chose Rock"
            rock := Pic.FileNew ("rock.bmp")     %Inserting Rock Image
            Pic.Draw (rock, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Rock"
            rock := Pic.FileNew ("rock.bmp")     %Inserting Rock Image
            Pic.Draw (rock, 380, 10, picCopy)
            delay (100)
            locatexy (320, 280)     %Saying You Tied
            put "You Tied" ..
            tie := tie + 1
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        end if



    elsif x > 180 and x < 400 and y > 10 and y < 280 then     %If choose Paper
        userchoice := 2
        randint (compchoice, 1, 3)     %Computer Choosing
        if userchoice = 2 and compchoice = 1 then     %If computer chooses rock you win
            cls
            put "You Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 10, 10, picCopy)
            locatexy (450, 400)
            delay (10)
            put "Computer Chose Rock"
            rock := Pic.FileNew ("rock.bmp")     %Inserting Rock Image
            Pic.Draw (rock, 380, 10, picCopy)
            locatexy (320, 280)     %Saying You Won
            put "You Won" ..
            win := win + 1
            delay (10)
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..

        elsif userchoice = 2 and compchoice = 2 then     %If computer chooses paper tie
            cls
            put "You Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 10, 10, picCopy)
            locatexy (450, 400)
            put "Computer Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 450, 10, picCopy)
            locatexy (320, 280)     %Saying You Tied
            put "You Tied" ..
            tie := tie + 1
            delay (10)
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        elsif userchoice = 2 and compchoice = 3 then     %If computer chooses scissors lose
            cls
            put "You Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 10, 10, picCopy)
            locatexy (450, 400)
            put "Computer Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp")     %Inserting Scissors Image
            Pic.Draw (scissors, 380, 16, picCopy)
            locatexy (320, 280)     %Saying You lost
            put "You Lost" ..
            lose := lose + 1
            delay (10)
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        end if



    elsif x > 420 and x < 620 and y > 16 and y < 280 then     %If choose Scissors
        userchoice := 3
        randint (compchoice, 1, 3)     %Computer Choosing
        if userchoice = 3 and compchoice = 1 then     %If computer chooses rock Lose
            cls
            put "You Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp")     %Inserting Scissors Image
            Pic.Draw (scissors, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Rock"
            rock := Pic.FileNew ("rock.bmp")     %Inserting Rock Image
            Pic.Draw (rock, 380, 10, picCopy)
            locatexy (320, 280)     %Saying You lost
            put "You Lost" ..
            lose := lose + 1
            delay (10)
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        elsif userchoice = 3 and compchoice = 2 then     %If computer chooses paper Win
            cls
            put "You Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp")     %Inserting Scissors Image
            Pic.Draw (scissors, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 380, 10, picCopy)
            delay (100)
            locatexy (320, 280)     %Saying You Lost
            put "You Win" ..
            win := win + 1
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        elsif userchoice = compchoice then         %If computer chooses Scissors then tie
            cls
            put "You Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp")     %Inserting Scissors Image
            Pic.Draw (scissors, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp")     %Inserting Scissors Image
            Pic.Draw (scissors, 380, 16, picCopy)
            delay (100)
            locatexy (320, 280)     %Saying You Tied
            put "You Tied" ..
            tie := tie + 1
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        end if
    end if

end loop

if key = "y" then             %play again
    loop
        buttonwait ("down", x, y, buttonnumber, buttonup)
        if x > 10 and x < 170 and y > 10 and y < 280 then %If choose Rock
            userchoice := 1
            randint (compchoice, 1, 3) %Computer Choosing

            if userchoice = 1 and compchoice = 3 then %If computer chooses scissors then win
                delay (10)
                cls
                put "You Chose Rock"
                rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
                Pic.Draw (rock, 10, 10, picCopy)
                delay (10)
                locatexy (450, 400)
                put "Computer Chose Scissors"
                scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
                Pic.Draw (scissors, 380, 16, picCopy)
                locatexy (320, 280) %Saying You Won
                put "You Won" ..
                win := win + 1
                locatexy (300, 200) %Displaying stats
                put "Wins: ", win ..
                locatexy (300, 180)
                put "Loses: ", lose ..
                locatexy (300, 160)
                put "Ties: ", tie ..
                locatexy (1, 350)
                put "Play again? y or n"
                getch (key)
            elsif userchoice = 1 and compchoice = 2 then %If computer chooses Paper then lose
                cls
                put "You chose Rock"
                rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
                Pic.Draw (rock, 10, 10, picCopy)
                delay (10)
                locatexy (450, 400)
                put "Computer Chose Paper"
                paper := Pic.FileNew ("paper.bmp") %Inserting Paper Image
                Pic.Draw (paper, 380, 10, picCopy)
                delay (100)
                locatexy (320, 280) %Saying You Lost
                put "You Lost" ..
                lose := lose + 1
                locatexy (300, 200) %Displaying stats
                put "Wins: ", win ..
                locatexy (300, 180)
                put "Loses: ", lose ..
                locatexy (300, 160)
                put "Ties: ", tie ..

            elsif userchoice = compchoice then %If computer chooses Rock then tie
                cls
                put "You chose Rock"
                rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
                Pic.Draw (rock, 10, 10, picCopy)
                delay (10)
                locatexy (450, 400)
                put "Computer Chose Rock"
                rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
                Pic.Draw (rock, 380, 10, picCopy)
                delay (100)
                locatexy (320, 280) %Saying You Tied
                put "You Tied" ..
                tie := tie + 1
                locatexy (300, 200) %Displaying stats
                put "Wins: ", win ..
                locatexy (300, 180)
                put "Loses: ", lose ..
                locatexy (300, 160)
                put "Ties: ", tie ..
            end if



        elsif x > 180 and x < 400 and y > 10 and y < 280 then %If choose Paper
            userchoice := 2
            randint (compchoice, 1, 3) %Computer Choosing
            if userchoice = 2 and compchoice = 1 then %If computer chooses rock you win
                cls
                put "You Chose Paper"
                paper := Pic.FileNew ("paper.bmp") %Inserting Paper Image
                Pic.Draw (paper, 10, 10, picCopy)
                locatexy (450, 400)
                delay (10)
                put "Computer Chose Rock"
                rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
                Pic.Draw (rock, 380, 10, picCopy)
                locatexy (320, 280) %Saying You Won
                put "You Won" ..
                win := win + 1
                delay (10)
                locatexy (300, 200) %Displaying stats
                put "Wins: ", win ..
                locatexy (300, 180)
                put "Loses: ", lose ..
                locatexy (300, 160)
                put "Ties: ", tie ..

            elsif userchoice = 2 and compchoice = 2 then %If computer chooses paper tie
                cls
                put "You Chose Paper"
                paper := Pic.FileNew ("paper.bmp") %Inserting Paper Image
                Pic.Draw (paper, 10, 10, picCopy)
                locatexy (450, 400)
                put "Computer Chose Paper"
                paper := Pic.FileNew ("paper.bmp") %Inserting Paper Image
                Pic.Draw (paper, 450, 10, picCopy)
                locatexy (320, 280) %Saying You Tied
                put "You Tied" ..
                tie := tie + 1
                delay (10)
                locatexy (300, 200) %Displaying stats
                put "Wins: ", win ..
                locatexy (300, 180)
                put "Loses: ", lose ..
                locatexy (300, 160)
                put "Ties: ", tie ..
            elsif userchoice = 2 and compchoice = 3 then %If computer chooses scissors lose
                cls
                put "You Chose Paper"
                paper := Pic.FileNew ("paper.bmp") %Inserting Paper Image
                Pic.Draw (paper, 10, 10, picCopy)
                locatexy (450, 400)
                put "Computer Chose Scissors"
                scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
                Pic.Draw (scissors, 380, 16, picCopy)
                locatexy (320, 280) %Saying You lost
                put "You Lost" ..
                lose := lose + 1
                delay (10)
                locatexy (300, 200) %Displaying stats
                put "Wins: ", win ..
                locatexy (300, 180)
                put "Loses: ", lose ..
                locatexy (300, 160)
                put "Ties: ", tie ..
            end if



        elsif x > 420 and x < 620 and y > 16 and y < 280 then %If choose Scissors
            userchoice := 3
            randint (compchoice, 1, 3) %Computer Choosing
            if userchoice = 3 and compchoice = 1 then %If computer chooses rock Lose
                cls
                put "You Chose Scissors"
                scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
                Pic.Draw (scissors, 10, 10, picCopy)
                delay (10)
                locatexy (450, 400)
                put "Computer Chose Rock"
                rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
                Pic.Draw (rock, 380, 10, picCopy)
                locatexy (320, 280) %Saying You lost
                put "You Lost" ..
                lose := lose + 1
                delay (10)
                locatexy (300, 200) %Displaying stats
                put "Wins: ", win ..
                locatexy (300, 180)
                put "Loses: ", lose ..
                locatexy (300, 160)
                put "Ties: ", tie ..
            elsif userchoice = 3 and compchoice = 2 then %If computer chooses paper Win
                cls
                put "You Chose Scissors"
                scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
                Pic.Draw (scissors, 10, 10, picCopy)
                delay (10)
                locatexy (450, 400)
                put "Computer Chose Paper"
                paper := Pic.FileNew ("paper.bmp") %Inserting Paper Image
                Pic.Draw (paper, 380, 10, picCopy)
                delay (100)
                locatexy (320, 280) %Saying You Lost
                put "You Win" ..
                win := win + 1
                locatexy (300, 200) %Displaying stats
                put "Wins: ", win ..
                locatexy (300, 180)
                put "Loses: ", lose ..
                locatexy (300, 160)
                put "Ties: ", tie ..
            elsif userchoice = compchoice then     %If computer chooses Scissors then tie
                cls
                put "You Chose Scissors"
                scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
                Pic.Draw (scissors, 10, 10, picCopy)
                delay (10)
                locatexy (450, 400)
                put "Computer Chose Scissors"
                scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
                Pic.Draw (scissors, 380, 16, picCopy)
                delay (100)
                locatexy (320, 280) %Saying You Tied
                put "You Tied" ..
                tie := tie + 1
                locatexy (300, 200) %Displaying stats
                put "Wins: ", win ..
                locatexy (300, 180)
                put "Loses: ", lose ..
                locatexy (300, 160)
                put "Ties: ", tie ..
            end if
        end if

    end loop

-----------------------------------
riveryu
Fri May 16, 2008 9:59 pm

Re: Quick Loop Question
-----------------------------------
It doesnt work when i ran your program...your program is rather long... Sry...
also, when you are posting, click the link/button that says "more tags" and click on "syntax" which will generate the  loop 
    %Does stuffs here 
    %More stuff, for lulz 
    put "Would you like ot play again?" 
    get Answer 
    exit when Answer = "n" 
end loop 

-----------------------------------
hossack
Fri May 16, 2008 10:32 pm

Re: Quick Loop Question
-----------------------------------

var rock, paper, scissors, rules : int
var x, y, buttonnumber, buttonup, WinID : int
var answer : string
var key : string (1)
var userchoice, compchoice : int
var win, lose, tie : int := 0

process domusic
    Music.PlayFileLoop ("daft punk - musique.mp3")
end domusic

randomize

fork domusic
drawfill (1, 1, 102, 102) %Filling in Backround
locatexy (200, 280) %locating Rock, Paper, Scissors
colorback (102)
put "Welcome to Ryan's Rock, Paper, Scissors Game!"

rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
Pic.Draw (rock, 10, 10, picCopy)

paper := Pic.FileNew ("paper.bmp") %Inserting Paper Image
Pic.Draw (paper, 190, 10, picCopy)

scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
Pic.Draw (scissors, 380, 16, picCopy)

locatexy (500, 1)
put "By Ryan Hossack"

locatexy (1, 1) %Clicking to go to next page
put "click to continue"
buttonwait ("down", x, y, buttonnumber, buttonup)
if x > 0 and x < 640 and y > 0 and y < 400 then
    cls
end if

rules := Pic.FileNew ("scissorDM_468x389.bmp") %Putting in Picture for Rules
Pic.Draw (rules, 100, 5, picCopy)

locatexy (1, 1) %Clicking to go to next page
put "click to continue"
buttonwait ("down", x, y, buttonnumber, buttonup)
if x > 0 and x < 640 and y > 0 and y < 400 then
    cls
end if


locatexy (280, 300)
put "Pick Rock, Paper, or Scissors"
rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
Pic.Draw (rock, 10, 10, picCopy)

paper := Pic.FileNew ("paper.bmp") %Inserting Paper Image
Pic.Draw (paper, 190, 10, picCopy)

scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
Pic.Draw (scissors, 380, 16, picCopy)


loop
    buttonwait ("down", x, y, buttonnumber, buttonup)
    if x > 10 and x < 170 and y > 10 and y < 280 then %If choose Rock
        userchoice := 1
        randint (compchoice, 1, 3) %Computer Choosing

        if userchoice = 1 and compchoice = 3 then     %If computer chooses scissors then win
            delay (10)
            cls
            put "You Chose Rock"
            rock := Pic.FileNew ("rock.bmp") %Inserting Rock Image
            Pic.Draw (rock, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp") %Inserting Scissors Image
            Pic.Draw (scissors, 380, 16, picCopy)
            locatexy (320, 280) %Saying You Won
            put "You Won" ..
            win := win + 1
            locatexy (300, 200) %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
            locatexy (1, 350)
            put "Play again? y or n"
            get answer
            exit when answer = "n"
  
            
        elsif userchoice = 1 and compchoice = 2 then     %If computer chooses Paper then lose
            cls
            put "You chose Rock"
            rock := Pic.FileNew ("rock.bmp")     %Inserting Rock Image
            Pic.Draw (rock, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 380, 10, picCopy)
            delay (100)
            locatexy (320, 280)     %Saying You Lost
            put "You Lost" ..
            lose := lose + 1
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..

        elsif userchoice = compchoice then     %If computer chooses Rock then tie
            cls
            put "You chose Rock"
            rock := Pic.FileNew ("rock.bmp")     %Inserting Rock Image
            Pic.Draw (rock, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Rock"
            rock := Pic.FileNew ("rock.bmp")     %Inserting Rock Image
            Pic.Draw (rock, 380, 10, picCopy)
            delay (100)
            locatexy (320, 280)     %Saying You Tied
            put "You Tied" ..
            tie := tie + 1
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        end if



    elsif x > 180 and x < 400 and y > 10 and y < 280 then     %If choose Paper
        userchoice := 2
        randint (compchoice, 1, 3)     %Computer Choosing
        if userchoice = 2 and compchoice = 1 then     %If computer chooses rock you win
            cls
            put "You Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 10, 10, picCopy)
            locatexy (450, 400)
            delay (10)
            put "Computer Chose Rock"
            rock := Pic.FileNew ("rock.bmp")     %Inserting Rock Image
            Pic.Draw (rock, 380, 10, picCopy)
            locatexy (320, 280)     %Saying You Won
            put "You Won" ..
            win := win + 1
            delay (10)
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..

        elsif userchoice = 2 and compchoice = 2 then     %If computer chooses paper tie
            cls
            put "You Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 10, 10, picCopy)
            locatexy (450, 400)
            put "Computer Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 450, 10, picCopy)
            locatexy (320, 280)     %Saying You Tied
            put "You Tied" ..
            tie := tie + 1
            delay (10)
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        elsif userchoice = 2 and compchoice = 3 then     %If computer chooses scissors lose
            cls
            put "You Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 10, 10, picCopy)
            locatexy (450, 400)
            put "Computer Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp")     %Inserting Scissors Image
            Pic.Draw (scissors, 380, 16, picCopy)
            locatexy (320, 280)     %Saying You lost
            put "You Lost" ..
            lose := lose + 1
            delay (10)
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        end if



    elsif x > 420 and x < 620 and y > 16 and y < 280 then     %If choose Scissors
        userchoice := 3
        randint (compchoice, 1, 3)     %Computer Choosing
        if userchoice = 3 and compchoice = 1 then     %If computer chooses rock Lose
            cls
            put "You Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp")     %Inserting Scissors Image
            Pic.Draw (scissors, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Rock"
            rock := Pic.FileNew ("rock.bmp")     %Inserting Rock Image
            Pic.Draw (rock, 380, 10, picCopy)
            locatexy (320, 280)     %Saying You lost
            put "You Lost" ..
            lose := lose + 1
            delay (10)
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        elsif userchoice = 3 and compchoice = 2 then     %If computer chooses paper Win
            cls
            put "You Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp")     %Inserting Scissors Image
            Pic.Draw (scissors, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Paper"
            paper := Pic.FileNew ("paper.bmp")     %Inserting Paper Image
            Pic.Draw (paper, 380, 10, picCopy)
            delay (100)
            locatexy (320, 280)     %Saying You Lost
            put "You Win" ..
            win := win + 1
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        elsif userchoice = compchoice then         %If computer chooses Scissors then tie
            cls
            put "You Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp")     %Inserting Scissors Image
            Pic.Draw (scissors, 10, 10, picCopy)
            delay (10)
            locatexy (450, 400)
            put "Computer Chose Scissors"
            scissors := Pic.FileNew ("scissors.bmp")     %Inserting Scissors Image
            Pic.Draw (scissors, 380, 16, picCopy)
            delay (100)
            locatexy (320, 280)     %Saying You Tied
            put "You Tied" ..
            tie := tie + 1
            locatexy (300, 200)     %Displaying stats
            put "Wins: ", win ..
            locatexy (300, 180)
            put "Loses: ", lose ..
            locatexy (300, 160)
            put "Ties: ", tie ..
        end if
    end if

end loop



-----------------------------------
hossack
Fri May 16, 2008 10:46 pm

RE:Quick Loop Question
-----------------------------------
thats the code for my program.

-----------------------------------
gitoxa
Fri May 16, 2008 11:04 pm

RE:Quick Loop Question
-----------------------------------
Okay, wow. Think about where your exit statement is.
