If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

loops in GUI

I've made loops before, but never in GUI, i don't know if it's the same, or very different. I have no idea were to start, I'm making a loop for my Tic-Tac-Toe code. I was wondering if anyone could explain how to make a loop in my tic-tac-toe code.

There is no difference between a loop in a gui and a loop in a command line program. The only difference is that a command line program typically needs a termination loop to run while the user wants to keep it running, while a framed program does not since it can detect the closure events, so you may save one by using a gui.

You don't need a loop in this code, you simply need to use another if branch so when a winner is determined you ask if they want to continue and clear the board if they do. I'd write a method for it to keep it simple. I'm not going to go through the code for the evaluation, but its near the bottom where it shows the win. So long as all buttons have been assigned, than you can prompt for a replay. A replay simply resets everything, so you'll want to modify the members to not initialize the variables, and use a method that does that for you. Call that method whenever a game is to be reset.

PHP Code:

header('HTTP/1.1 420 Enhance Your Calm');

Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)