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 / I need a draw subrutine

Author
Message
Unseen Ghost
23
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 13th Jul 2003 05:41
Hi,
I need a subrutine for when you have a draw in tic tac toe.
I'm still learning the language so bare with the long code.
The way I have it set up, it prints the winner stuff when there is a winner and the draw stuff when there is a draw, but if someone wins on the last turn it prints the winner stuff and the draw stuff. If someone wins on the last move I don't want it to print the draw stuff if it isn't supose to. (obviosly right) LOL

I believe I need to set up something that checks for a win on the 9th move of the game and if there is no winner then it prints It's a draw. Can someone help me ?
Here is my code that I have from the loop on down

UnseenGhost
Codger
23
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 13th Jul 2003 09:03
the First Suggestion I would make is to rethink your apparoach. Consider the point that tic tac toe is an array of 3 x 3

dim tictactoe(3,3)

This allows you to check for all conditions using

for x = 1 to 3
for Y = 1 to 3
Testfuntion1(x,y)
next y
next x

I believe this will rationalize you approach

Rob K
Retired Moderator
23
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 13th Jul 2003 12:46
JFYI, its spelt subroutine

Philip
23
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 13th Jul 2003 13:38
About a month back I posted code for a complete Noughts & Crosses (to us Brits) or Tic Tac Toe (to Yankees) game. I've attached it again.

Unfortunately it uses sub-routines but that was because I was being lazy and didn't feel like using functions, like a good bear should.

Cheers

Phil

What do you mean, bears aren't supposed to wear hats and a tie?
Unseen Ghost
23
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Ohio
Posted: 13th Jul 2003 17:47
Thanks for all the help.

I'll see what I can do now.

UnseenGhost

Login to post a reply

Server time is: 2026-07-21 12:49:21
Your offset time is: 2026-07-21 12:49:21