forums

TNT Basic Forums > Programming Q&A
Nested array variables?
< Last Thread     Next Thread >
Author
Thread        Post A Reply

10-29-2009 20:27

Posted by:
JHVipond

Location:
South Dakota

Find more posts by JHVipond

I just received a copy of Invent Your Own Computer Games, a 1983 book by Fred D'Ignazio, which I purchased from an Amazon seller because the book has BASIC source code for a tic-tac-toe game.

I see that the "computer win" and "block" subroutines have a variable (BD(GM(J)), where BD is an array for the nine cells on the tic-tac-toe grid, GM is a 24-element array for the computer's priority list of moves from best to worst, and J is the counter in a FOR loop. Are such nested array variables legal in TNT Basic? The TNT Basic user guide doesn't mention them.

10-30-2009 00:28

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Good question...

The index into an array simply needs to equate to an integer, and as TNT will accept a variable or calculation, I see no reason why it wouldn't accept another array reference (as long as that reference also equates to an integer). So to answer your question as best as I can I'd say yes, though I've never tried it myself.

Give it a go and let us know if it works,,, (but yes, it should)

Danny (nod the mod)

10-30-2009 16:39

Posted by:
JHVipond

Location:
South Dakota

Find more posts by JHVipond

I tried it, Danny, and it worked perfectly. It helped that D'Ignazio wrote his programs on an Atari 800, and TNT Basic is very similar to Atari BASIC.

10-30-2009 17:38

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

I had a feeling it might...

Yes, TNT has a very Atari like feel to it, and was inspired by the old Atari / Amiga programs (STOS on Atari and AMOS on Amiga) written by a guy called François Lionet back in '88.

I wrote my first two games in STOS in 1988/89, the first one took me a couple of weeks and was absolute pants, the second took me a couple days and got me a contract with TopByte Software... I loved STOS!

Enough reminiscing, I'm glad it all worked for and good luck with the game...

Danny (nod the mod)

(P.S. If you're looking for books on game creation I can highly recommend "The Game Maker's Manual" by Stephen Hill - ISBN: 1-85058-158-4)

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.