Loop Reset Problem
Author |
Message |
CanadianIdiot
|
Posted: 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.
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
Cards (4).t |
Filesize: |
16.88 KB |
Downloaded: |
75 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Raknarg
![](http://compsci.ca/v3/uploads/user_avatars/3745510004d8be6689b92f.jpg)
|
Posted: 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.
|
|
|
|
|
![](images/spacer.gif) |
CanadianIdiot
|
Posted: 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.
|
|
|
|
|
![](images/spacer.gif) |
|
|