Computer Science Canada

Black Jack Game loop problem in GUI - help greatly appreciated

Author:  zaindapain [ Thu Jan 21, 2010 4:12 pm ]
Post subject:  Black Jack Game loop problem in GUI - help greatly appreciated

What is it you are trying to achieve?
I have made a blackjack game using procedures
However, the main program is not working like a "blackjack game" because the looping and exiting the loop at the right time is not working.


What is the problem you are having?
The program deals 2 cards to the user and the CPU at the beginning
Then the user has a chance to hit or stay. When a result is finally acheived, instead of starting the dealing all over from the beginning, the program allows the user to continue hitting and staying even if they lose or win
I need someone to read the loop and the exit when statements in the "Hit" and "Stay" commands from the GUI buttons and see what is wrong with the logic there.
Thank you very much as it'd mean a lot to me Sad


Describe what you have tried to solve this problem
I have tried many different loops however, none of them seem to exit at the right time
IF someone could read up on my program and offer some help i'd greatly appreciate it. Thank you.

Author:  zaindapain [ Fri Jan 22, 2010 8:01 pm ]
Post subject:  RE:Black Jack Game loop problem in GUI - help greatly appreciated

no help ? :'(

Author:  zaindapain [ Mon Jan 25, 2010 12:57 pm ]
Post subject:  RE:Black Jack Game loop problem in GUI - help greatly appreciated

bump..

Author:  TheGuardian001 [ Mon Jan 25, 2010 1:58 pm ]
Post subject:  Re: Black Jack Game loop problem in GUI - help greatly appreciated

Well, for one thing, at the end of your program, you have this:
code:

loop
        exit when uchips = 0 or GUI.ProcessEvent
end loop


This loop will never exit until the user has 0 chips left. So once the dealer wins, it just keeps letting the user play until they have no chips left.

You're going to need 2 loops for this to work properly. 1 that starts where the user places their bet (so they can play again after one round), and another one inside of the first loop that only goes around the checking for a win/bust (as well as the GUI.ProcessEven/chips = 0 line). This second loop will ensure that they keep playing a single round until somebody wins/is bust.

Author:  zaindapain [ Thu Jan 28, 2010 10:12 am ]
Post subject:  RE:Black Jack Game loop problem in GUI - help greatly appreciated

o
thnk you
but i already new that
can you fix it for me
caz when i do that it still wont work right Sad

Author:  ProgrammingFun [ Thu Jan 28, 2010 1:19 pm ]
Post subject:  Re: RE:Black Jack Game loop problem in GUI - help greatly appreciated

zaindapain @ Thu Jan 28, 2010 10:12 am wrote:
o
thnk you
but i already new that
can you fix it for me
caz when i do that it still wont work right Sad


I'm sorry but no one will do your code for you
You could tell us what you are having trouble with and we can GUIDE you.

Author:  zaindapain [ Mon Feb 01, 2010 6:45 pm ]
Post subject:  RE:Black Jack Game loop problem in GUI - help greatly appreciated

but thas what my problem is
what he told me to do is jus basically saying
"solve it your self.. and just repeated the problem again in different words.. "

Author:  TheGuardian001 [ Mon Feb 01, 2010 7:32 pm ]
Post subject:  Re: Black Jack Game loop problem in GUI - help greatly appreciated

zaindapain wrote:

solve it your self


Yes, you actually have to do your own work. What a surprise. We can tell you how to solve a problem (and I did, I told you exactly where to put your loops), but it's your work and you have to do it.

Author:  Velocity [ Wed Jan 18, 2012 6:10 pm ]
Post subject:  RE:Black Jack Game loop problem in GUI - help greatly appreciated

lol whatta lazy bum

Author:  Insectoid [ Wed Jan 18, 2012 6:13 pm ]
Post subject:  RE:Black Jack Game loop problem in GUI - help greatly appreciated

lol whatta freakin' necro.


: