cellular automata

oolfur's icon

hi board

does anyone have good ideas on how to make a clever conway's game of life patch using just max objects?

i'm thinking coll + matrix, but i'm not so good at managing data within coll...

how would you make each cell in a matrix check the states of surrounding cells?
i'm sure this can be solved in a brilliant way!

.klive

Sophia's icon

um, have you tried jit.conway?

oolfur's icon

yeah, but that's a jitter object.

any thoughts on this?

andrea agostini's icon

not sure it's a clever way, but I would use two [lcd]s, and getpixel to retrieve the cells states
aa

oolfur's icon

here's my idea towards a working patch;

Max Patch
Copy patch and select New From Clipboard in Max.

the result is somewhat strange, the array of numbers seems to make something a lot different from conway's game of life... any thoughts on the error here?

also, how would you translate an array of 64 numbers back into the matrix to create a loop?

the osc objects connect to a monome... i know there are some working cellular automata patches out there - but i prefer building this one from scratch.

any help would be greatly appreciated!!!
thanks!

.klive

oolfur's icon

anyone?

Luke Hall's icon

It looks like the problem is the stage where you query the cell neighbours. When you are looking at cells on the side colums the offsets end up wrong. For example: -9 from any cell in the left row will not be a neighbour. You need to map these values properly, either wrapping the edges around or not.

This isn't the easiest thing to do in max, it's probably better suited to a text based language (perhaps javascript which you can use in max) where creating loops is simpler, or jitter where [jit.conway] does all the hard work for you. That's not to say it isn't possible. Here is one example ready for use with the monome and below is a non-wrapping example which probably isn't as cleanly written. In max5 format currently I'm afraid.

Max Patch
Copy patch and select New From Clipboard in Max.

lh

oolfur's icon

thanks luke! that is the most straightforward approach to this problem i've seen.

there seems to be a problem with the coll's in the neighbours subpatch... they aren't storing anything.

they need initial values?

.klive

Luke Hall's icon

Oh right, sorry I thought I had them embedded. They're just the offsets needed normally (like in your patch) and for the side columns. There's probably a much easier way to go about patching this anyway. I'm waiting for my monome to arrive so I've been looking into something similar anyway. I might try doing it in javascript and see how that goes, I'll post back here if I have any success.

lh

Mid:
0, -9;
1, -8;
2, -7;
3, -1;
4, 1;
5, 7;
6, 8;
7, 9;

Left:
0, -8;
1, -7;
2, 1;
3, 8;
4, 9;

Right:
0, -9;
1, -8;
2, -1;
3, 7;
4, 8;

oolfur's icon

thanks! this is awesome!

oolfur's icon

here is your patch in max v.4

Max Patch
Copy patch and select New From Clipboard in Max.

this patch doesnt work in maxv4 but suddenly does when opened in max5...
does max 5 behave differently with some of the objects in this patch?

oolfur's icon

aha, zl lookup and sum dont work in version 4.

oolfur's icon

heres a max v.4 patch with zl object replacements....

Max Patch
Copy patch and select New From Clipboard in Max.

any thoughts on why it's acting strange?
the results are cool though...

.klive

oolfur's icon

i am soooo close! please help!

Luke Hall's icon

Here's some replacements, haven't checked if [zl iter] or [iter] were around in max4 but these should do the job for you.

Max Patch
Copy patch and select New From Clipboard in Max.

lh