Create a go board in Max

This patch demonstrates how to create a 19x19 matrix that functions as a sort of "go" board, in which each mouse click alternates between placing a white or black square in a cell of the matrix. It's meant to demonstrate how a matrix can be used to store a multidimensional array of states or conditions.

Store matrices in a text file

To store an array of integers, you will usually use the table object. To store an array of floating point values, you can use the buffer~ object. Although the buffer~ object is normally used for storing audio data, it can easily be used simply as an array of floats, accessed by the peek~ object, which works even when MSP audio is not on.

Copying one matrix to another

To set matrix “B” to have the contents of matrix “A”, you simply send “A” to “B”. (More specifically, you cause matrix “A” to send a jit_matrix message to matrix “B”.) The trick, though, is to suppress thruput on matrix “B” by setting its @thru attribute to 0 (it’s 1 by default), so that you can set and recall its contents independently.