Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / do loop and for next loop

Author
Message
Unseen Ghost
23
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 11th Jul 2003 03:32
Hi,

I have a couple problems really.

1. No matter which loop I use I don't think I need the t=t+1 inside the loop, but if I take it out it tells me that the next t statement or the loop statement is out of place.

2. I have been trying to get a condition statement somewhere in the program for when it is a draw. but everywhere I put it, the program doesn't run right.

I know my program is quite lengthy, but I will make it shorter when I learn more in the language. So bare with the long code. Can anyone help ?

UnseenGhost
Dr DooMer
23
Years of Service
User Offline
Joined: 22nd Dec 2002
Location: United Kingdom
Posted: 11th Jul 2003 04:21 Edited at: 11th Jul 2003 04:26
Here's how I would recode the first for-next loop I came across:


I've also included the best place to check for a draw. However, the code required to check for a draw is slightly more tricky: you'll have to analyse the board and make sure that there is nowhere on it where a 3-length line can be made.

Note: Unless it's changed since DBClassic, you shouldn't put the extra ":" on the end of a gosub command. Also, you don't need the step part of a for loop if you're simply incrementing by one.

Hope this helps!

Unseen Ghost
23
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 11th Jul 2003 04:29
Thanks,

I will change it. I will see if I can take that t=t+1 out also. Maybe this will fix both problems with the program. If not I will be back thanks.

UnseenGhost

Login to post a reply

Server time is: 2026-07-18 07:31:23
Your offset time is: 2026-07-18 07:31:23