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

Username:   Password: 
 RegisterRegister   
 Loop Reset Problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
CanadianIdiot




PostPosted: Wed Jun 06, 2012 5:36 pm   Post subject: Loop Reset Problem

What is it you are trying to achieve?
I have a loop to run my game, and outside of that I have another loop to reset my variables, then run the game again. I want the first loop to reset my variables; however, the code seems to be skipping this.

What is the problem you are having?
When I run my program, it seems to be skipping to the second loop, even after exiting the loop.

Describe what you have tried to solve this problem
I have tried checking for errors, and using recursion, but these did not fix my problem.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
The code is attached; my main function that isn't working is the BlackJack procedure.

Please specify what version of Turing you are using
Turing 4.1.1.



Cards (4).t
 Description:

Download
 Filename:  Cards (4).t
 Filesize:  16.88 KB
 Downloaded:  75 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Raknarg




PostPosted: Wed Jun 06, 2012 7:42 pm   Post subject: RE:Loop Reset Problem

exit when ptinrect (x, y, 850, 40, 907, 87)

This is at the very end of that double loop. That's probably whats giving you trouble.
CanadianIdiot




PostPosted: Wed Jun 06, 2012 7:59 pm   Post subject: RE:Loop Reset Problem

@Raknarg
That didn't seem to fix my problem; what's mostly happening is that after I have my cards value go over 21, then reload the game and get a value less than 21, it continues to give me that I busted.

So, I have a value of 18, get another card, and get a value of 24. It then tells me I busted, which is correct.

Next, I exit the loops, and go into the main screen. I replay the game, and have a value of 20, so I hit stay. However, when the game ends, it tells me that I busted, even though I have fewer than 21.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: