In TI-BASIC, matrices are essentially two-dimensional lists with limitations. There are only a few math commands that work on matrices: =, ≠, the dedicated matrix commands, and these:

tibasicdev wrote:
abs( and angle( (but no other complex number commands) [...]
fPart(, iPart(, int(, and round(

Additionally, scalar multiplication works on matrices.

These select commands are actually very useful: recall that, for example, the following code


gets the 7th digit from the right of a scalar A. Applying this to an entire matrix:


gives the 7th digit of every element of [A]. Therefore, since floats can be stored to a precision of 14 digits, and matrices can be 20x20, it is possible to create a sort of 20x20x14 array of digits, from which each z-slice can be extracted easily. This can be applied, for example, to a game with a small 3d map for which there can be up to 10 tile types (maybe a maze).

It's possible to reduce the number of tile types while increasing the size of the matrix in the z-direction, by using a different base's digits. For example, in base 2, a float can store 44 bits, allowing an enormous 20x20x44 maze. However, multiplication is slower when not by powers of ten, so this comes at the expense of speed.

Using matrix multiplication, it's also possible to take x-slices and y-slices of the 3d array, and even rotate and flip the matrix.
Very Happy This is Interesting
Nice trick. Back then, I wanted to experiment with 3D matrices, but the only idea I had was to take the approach of using multiple matrices on top of each others or just use a 90x10 matrix to form a 10x10 grid with 9 layers. But the problem is that this limits the size of tilemaps and the 84+CE doesn't allow more than 400 elements per matrix anyway.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum