Author |
Message |
Tasuba
|
Posted: Sat Apr 03, 2010 8:36 pm Post subject: Rock paper scissors! Exiting |
|
|
What is it you are trying to achieve?
My program is to play rock paper scissors
What is the problem you are having?
The exit loop would not work
Describe what you have tried to solve this problem
Made more than 1 loop and if statements
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Files are attached
Please specify what version of Turing you are using
Turing 4.1.1
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
ics2o.t |
Filesize: |
527 Bytes |
Downloaded: |
118 Time(s) |
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
roShamBo.t |
Filesize: |
2.37 KB |
Downloaded: |
102 Time(s) |
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
topScore.txt |
Filesize: |
16 Bytes |
Downloaded: |
110 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
ProgrammingFun
![](http://compsci.ca/v3/uploads/user_avatars/11682880074bcb590d30b0a.png)
|
Posted: Sat Apr 03, 2010 9:22 pm Post subject: RE:Rock paper scissors! Exiting |
|
|
You do not have re-post this topic to answer the template, you could have simply posted your problem in the previous thread.
|
|
|
|
|
![](images/spacer.gif) |
Zren
![](http://compsci.ca/v3/uploads/user_avatars/1110053965512db6185954b.png)
|
Posted: Sat Apr 03, 2010 9:29 pm Post subject: RE:Rock paper scissors! Exiting |
|
|
Use a variable and make both loops have an exit when.
Turing: | var exitLoops : boolean := false
loop
loop
exit when exitLoops = true
exitLoops := true
end loop
exit when exitLoops = true
end loop
|
|
|
|
|
|
![](images/spacer.gif) |
Tasuba
|
Posted: Sat Apr 03, 2010 9:44 pm Post subject: Re: Rock paper scissors! Exiting |
|
|
well this would work but I also need it to ask if it wants to try again....which was the problem in the start.....sorry for not clarifying
|
|
|
|
|
![](images/spacer.gif) |
Zren
![](http://compsci.ca/v3/uploads/user_avatars/1110053965512db6185954b.png)
|
Posted: Sat Apr 03, 2010 10:05 pm Post subject: RE:Rock paper scissors! Exiting |
|
|
Think how you want the loops structured. Imagine removing all you loops and placing them again. Here's how your game probably wants to work:
Load HS
Play Round of RPS
Check Win/Lose
...
Play Round of RPS
Check Win/Lose
You lost, save HS, play again?
Yes I do
Play Round of RPS
Check Win/Lose
...
Play Round of RPS
Check Win/Lose
You lost, save HS, play again?
No I don't
|
|
|
|
|
![](images/spacer.gif) |
Tasuba
|
Posted: Sun Apr 04, 2010 10:30 am Post subject: Re: Rock paper scissors! Exiting |
|
|
problem has been solved.
|
|
|
|
|
![](images/spacer.gif) |
|