Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Rock paper scissors! Exiting
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Tasuba




PostPosted: 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



ics2o.t
 Description:

Download
 Filename:  ics2o.t
 Filesize:  527 Bytes
 Downloaded:  118 Time(s)


roShamBo.t
 Description:

Download
 Filename:  roShamBo.t
 Filesize:  2.37 KB
 Downloaded:  102 Time(s)


topScore.txt
 Description:

Download
 Filename:  topScore.txt
 Filesize:  16 Bytes
 Downloaded:  110 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
ProgrammingFun




PostPosted: 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.
Zren




PostPosted: 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
Tasuba




PostPosted: 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
Zren




PostPosted: 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
Tasuba




PostPosted: Sun Apr 04, 2010 10:30 am   Post subject: Re: Rock paper scissors! Exiting

problem has been solved.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: