How to fill a matrix with a checkerboard pattern?

discopatrick's icon

Does anyone know a nice elegant way to fill a matrix with a checkerboard pattern?

Let's say for example that the two colours will be cyan and magenta. Also, each square will be just one cell of the matrix.

I could use uzi and counter to loop through all the odd cells and then all the even cells, but I'm guessing there's a more efficient way.

Nat's icon

jit.bfg, check the help, third tab "checker"
Would that do ?

discopatrick's icon

Yes, I did see that shortly after I posted! I will experiment... I need to find the right settings so that the pattern matches up perfectly to the resolution of the matrix - one square per cell/pixel.

Cphas's icon

You could also investigate using [jit.expr] with the cell arguments

Christopher Dobrian's icon
Max Patch
Copy patch and select New From Clipboard in Max.

I'd say, just do it once with uzi and you're done with it in a few microseconds never to worry about it again.

Wesley Smith's icon

A simple and efficient technique would be to use jit.gen along with [cell] [%] and [

Christopher Dobrian's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Yes, gen is great for cellwise stuff.