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.

Newcomers DBPro Corner / Tic Tac Toe - Help!!!

Author
Message
fearred
15
Years of Service
User Offline
Joined: 18th Sep 2009
Location:
Posted: 19th Sep 2009 02:24
This is just a tic tac toe game that I'm working on. For some reason a few things don't work in the game. If you could take a look at my code and just point out all of the silly noob mistakes I'm making that would be great!




P.S. This is unfinished and it can't tell if you've won and there is no AI yet.
chwilly
15
Years of Service
User Offline
Joined: 23rd Feb 2009
Location:
Posted: 19th Sep 2009 05:58
Uh, the Board array needs to be global for one thing.

Actually, your using variable interchangebly in functions without first setting them as global:

global dim Board(9)
global PlayerTurn
gloabl PlayerWin
global Choice

I made a tic-tac toe game a long (long) time ago. I think there is a more efficient way of doing it. There are actually some tutorials on the net for programming tic-tac-toa AI.
chwilly
15
Years of Service
User Offline
Joined: 23rd Feb 2009
Location:
Posted: 19th Sep 2009 06:05
Ok I changed the Variables function to this:



But your program keeps craching my computer. (A tic-tac-toe game?)

What are you doing here:



You've got a sub label inside a function without a return?
Dream And Death
18
Years of Service
User Offline
Joined: 21st Feb 2006
Location: The circus! Juggling job, kids and DBPro
Posted: 19th Sep 2009 11:28
Sorry to correct you chwilly, but in DBP, arrays are global unless declared otherwise...so
global Dim Board(9)
is the same as
Dim Board(9)

"You get what everyone gets, you get a lifetime!" - Death, The Sandman Library

First you Dream, then you ... - Neil Gaiman, 2001

Login to post a reply

Server time is: 2024-11-24 01:23:11
Your offset time is: 2024-11-24 01:23:11