Lesson 9 - The value of Matrices
Matrices are
valuable. I say this because I used them in Tic-Tac-Toe to
detect a win. I was browsing through my manual trying to
figure out a way to detect a win and BAM! I see something that
looks just like a Tic-Tac-Toe board - a matrix. So here are
a few commands to help you use matrices. If you are
attempting Tic-Tac-Toe in BASIC, it's possible so don't despair.
The following creates a Matrix that is 3 by 3 and named TI:
:[[2,5,6][2,8,9][2,5,2]]->TI
So, this is your matrix. If you want one player's move to create a 0 on the matrix it goes like this: If your player has placed an "X" in the lower left hand corner of the playing area and you want your program to change this area that correponds on the matrix to a 0:
:0->TI(3,1)
Remember, row, then column!
Thats all you need to know about matrices to create Tic-Tac-Toe. It's a challenge, and if you succeed, send the program to saber_knight@hotmail.com and I'll tell you if mine is smaller. Or you could just download mine and compare, but please don't copy my program!