MUFF WIGGLER Forum Index
 FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 
WIGGLING 'LITE' IN GUEST MODE

Conway's Game of Life for nw2s::b and Monome grid
MUFF WIGGLER Forum Index -> nw2s Goto page 1, 2  Next [all]
Author Conway's Game of Life for nw2s::b and Monome grid
a scanner darkly
UPDATE: v1 is now complete. It's included in the 1.1 firmware - see this thread for details. Please note: the pre-alpha 1.1 release does not include saving / restoring config to SD card - you would need to grab the latest 1.1 from github if you need that.

This is a sketch for nw2s::b module that implements Conway's Game of Life and translates it into triggers and control voltages by taking advantage of the ::b's vast number of outputs (the sketch generates 16 triggers and 16 control voltages). It's designed to work with a connected monome grid using it for both visualization and control (see this thread for more information on how to connect a grid).

If you're unfamiliar with the Game of Life check out this link: http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

In a nutshell it's a cellular automaton defined by 2 very simple rules - a new cell is created if an empty cell has 3 neighbours, and a live cell stays alive if it has 2 or 3 neighbours. These simple rules can create amazingly complex and varied colonies of cells. But here this concept is taken further by putting the rules under CV control, and giving you the ability to kill or create new cells by touch.

Video tutorials:




A couple of older videos:
http://www.youtube.com/watch?v=U7FaYfkWgjg
http://www.youtube.com/watch?v=QGaxsMB6-uA

INSTALLATION
- Either download the 1.1 firmware from GitHub (if you know how to do it and how to upload using the Arduino IDE) or follow instructions from this thread
- The following instructions are only if you want to use the Arduino IDE.
- Open bGameOfLife sketch in Arduino IDE
- Make sure to update the following line:
Code:
grid = GameOfLife::create(DEVICETYPE, COLUMNS, ROWS, VARIBRIGHTNESS);

- replace DEVICETYPE with DEVICE_40H_TRELLIS if you have the 40h grid, DEVICE_SERIES if you have the series grid and DEVICE_GRIDS for the latest edition grids
- replace COLUMNS with the number of columns on your grid
- replace ROWS with the number of columns on your grid
- replace VARIBRIGHTNESS with true if your grid supports VB and false otherwise
- Example - the following line will set up the sketch to work with the latest edition grid128 that supports VB:
Code:
grid = GameOfLife::create(DEVICE_GRIDS, 16, 8, true);

- finally, upload your sketch to the ::b. Now press some buttons!

Disclaimer: the 1.1 version of firmware is still in alpha, so there might be some things that don't fully work. I did test it with my VB grid 128.

HOW TO USE
Ok, you’re running it and nothing is happening. That’s because you don’t have any live cells yet. Simply press grid buttons to create new cells and see what happens.

Let’s start with the outputs:
- The top row gets mirrored on digital outputs, by default those will be triggers. So whenever a cell in the top row becomes live the corresponding digital output will get a trigger. They’re synced to the clock, of course, as the next generation gets populated on the clock, but if you manually create any cells in the top row those will send a trigger without waiting for the clock.
- The first two digital outputs are an exception as they are reserved for something else: the first one goes high when the colony becomes too populated, and the second one goes high when the colony is too small. This is handy if you want a self playing patch as you can use these triggers to trigger new random colonies, for instance, ensuring that life never stops. Since these two will never be high at the same time you can use a simple mixer to get a trigger when a colony is either too populated or too small.
- Each column also gets a corresponding output on one of the analog outputs. If all the cells in that column are dead the voltage is at 0. If all the cells are alive the voltage is at the maximum (the actual value depends on your version of the ::b). This scale can be changed on the control page if you need to define a smaller range for your modulations.

The real fun starts when you start bending the rules! And there are many ways to do so.
- Instead of creating new cells by pressing buttons you can use digital in #2 – send a trigger here and it will create a new cell, or several. There are several predetermined shapes that were chosen to work well with the classic rules, and, of course, you can CV control the shape itself by using the analog input #2. The new shape will be created at the coordinates specified by the analog inputs #3 and #4 – so you can CV control that too. The last 4 shapes are gliders – useful for repeatable actions.
- If you want something more drastic try digital input #3 – a trigger here will replace the current colony with a completely new randomly generated one. The density of the new colony is determined by the analog input #9. This can be useful for self playing patches – use the digital outputs #1 and 2 for this – this way it will keep going no matter what happens.
- Triggers to the digital inputs 5/6/7/8 will shift the colony left/right/up/down – Try plugging some of the digital outputs here!
- Instead of using the classic rules try your own – you can control them by using the analog inputs 5-8. To switch to CV rules you have to put the digital input #4 to the left position (you can use a gate or trigger here too for interesting effects…) Analog inputs 5 and 6 control the minimum and maximum number of neighbours for a cell to be born, and number 7 and 8 control the min and max number of neighbours to survive. This is all about finding sweet spots as creating conditions for life can be tricky, but spend some time here and you can get some really crazy patterns, especially if you plug some of the analog outputs here, so that the game will control itself.

Control page:
- You can use the control page to adjust the outputs. To enter the control page press the two top leftmost buttons together. They’ll be constantly lit up while you’re on the control page so that you know where you are (the Game itself continues to run while you’re on the control page).
- The top row lets you select between triggers and gates for the digital outputs. When it’s lit it means it’s set to gate, otherwise it’s a trigger.
- The bottom row is reserved for v2, so nothing will happen if you press there.
- The area in between lets you control the CV range for the analog outputs for each column. To select a new range press any two buttons in that column and it will scale the voltage accordingly.
- To exit the page press the two top leftmost buttons again. When you exit the control page all of your settings are saved on the SD card, and they will get loaded automatically next time you use the sketch (or if you press the reset button). - not supported in the pre-alpha 1.1 release, grab the latest 1.1 from github instead if you want this.

Finally:
- if you have a grid that supports varibrightness you will see cells getting dimmer as they get older
- tempo can be CV controlled (analog input 1) or it can be slaved to external clock – you need to modify your sketch or JSON for this!
- I recommend reading up on GoL to see how you can use different building blocks to have some control over your colony. But really it’s all about playing with it – you’ll get something crazy going very soon!

PLANNED FEATURES
- ability to pre-populate the grid with JSON
- using tilt for shifting
- "note" mode on CV outs with quantization and choice of scale
- "varibright" version with cells having 16 states instead of 2

QUICK GUIDE



Any questions / feedback / bug reports etc please contact me at fuzzybeacon at gmail dot com.
myecholalia
Beautiful work, and the planned feature list looks exciting. Will give this a spin when I get home tonight. Thanks for sharing!
glia
wow
a scanner darkly
myecholalia wrote:
Beautiful work, and the planned feature list looks exciting. Will give this a spin when I get home tonight. Thanks for sharing!


thumbs up

Let me know how it goes! What model of grid do you have?

Added a couple more things to planned features:
- "note" mode for analog outs with quantization and ability to choose scale
- triggers in for shifting everything left/right/up/down
a scanner darkly
progress update:

- a trigger in to generate a new random colony
- triggers to shift the colony left / right / up / down
- changed digital outputs to generate triggers instead of gates for now (will be selectable in the final version per output)
- on varibright grids cells will now get dimmer as they age

Pretty cool connecting the digital outputs (which are triggered by new cells in the top row) to the digital ins controlling the shift :-)

edit: forgot to mention - Scott fixed external clock (so can be slaved to another clock now) and added JSON support thumbs up
djthopa
a scanner darkly wrote:
This thread is for all things related to Conway's Game of Life implementation to be used with nw2s::b and Monome grid.

If you're unfamiliar with the Game of Life check out this link: http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

In a nutshell it's a cellular automaton defined by 2 very simple rules - a new cell is created if an empty cell has 3 neighbours, and a live cell stays alive if it has 2 or 3 neighbours. These simple rules can create amazingly complex and varied colonies of cells. Of course, with the ::b implementation you will have much more control over the rules, and the ability to create or kill cells simply with your touch!

Here is a video demo of a prototype - I'll post more videos once I can take videos that don't look as crappy :-)



USAGE
- Download the 1.1 version of firmware from GitHub: https://github.com/nw2s/b/tree/b-1.1.0-unstable
- Open bGameOfLife sketch in Arduino IDE
- Make sure to update the following line:
Code:
grid = GameOfLife::create(DEVICETYPE, COLUMNS, ROWS, VARIBRIGHTNESS);

- replace DEVICETYPE with DEVICE_40H_TRELLIS if you have the 40h grid, DEVICE_SERIES if you have the series grid and DEVICE_GRIDS for the latest edition grids
- replace COLUMNS with the number of columns on your grid
- replace ROWS with the number of columns on your grid
- replace VARIBRIGHTNESS with true if your grid supports VB and false otherwise
- Example - the following line will set up the sketch to work with the latest edition grid128 that supports VB:
Code:
grid = GameOfLife::create(DEVICE_GRIDS, 16, 8, true);

- finally, upload your sketch to the ::b. Now press some buttons!

Disclaimer: the 1.1 version of firmware is still in beta, so there might be some things that don't fully work. I did test it with my VB grid 128.

CURRENT FEATURES
- it supports any grids that are supported by the firmware
- tempo is controlled by the analog input #1
- a trigger is sent to digital outs 1-16 when a new cell born in the top row
- for each column there is a corresponding analog output which outputs voltage related to the number of live cells in that column, so 0 if all are dead and max voltage (actual value depends on your ::b) when each cell is alive
- pressing a button flips that cell - if there is no cell it will create one, if there is a cell it will kill it
- JSON support
- trigger or gate to digital in 3 will replace current colony with a new random one
- triggers or gates to digital ins 5/6/7/8 will shift the colony left/right/up/down (try plugging some of the digital outs to this!)
- on varibright grids cells get dimmer as they age
- tempo can be CV controlled or it can be slaved to external clock

I recommend reading up on GoL to see how you can use different building blocks to have some control over your colony.

PLANNED FEATURES
- ability to generate new cell at the coordinates specified by 2 analog ins upon receiving a trigger on a digital in
- CV control over the rules (2 analog ins control min and max number of neighbours to stay alive, another 2 contro min and max of neighbours for new cells)
- assign a digital in to switch between the classic rules and CV controllable rules
- assign a digital in to switch probability on / off and an analog in to control the chance (applied to number of neighbours)
- assign a digital out for a gate that goes high when a colony gets too big / too small
- "varibright" version with cells having 16 states instead of 2
- ability to select between gates and triggers for the digital outs

POTENTIAL FEATURES
- assign analog in to control shapes for new cells created via a trigger in
- control over the range of neighbours?
- control page to allow specifying voltage range on each analog out / switching each analog out to note mode, choosing quantization scale for note mode, switching between gate / trigger on each individual digital output


Hi there, i have been following your progress and i got to thank you for your work. Im receiving my bee soon and i cant wait to use it with my monomes.

I hope to learn soon how to code my own sequencers and implement them on the bee and the monomes.

Thanks a lot!
a scanner darkly
thumbs up

I've updated the list of features, I'm hoping to have all the planned features implemented in the next week, and the rest will probably be a version 2 at some point in the future.

The firmware takes care of a lot of low level plumbing so it's fairly easy to start coding your own stuff. Will be happy to help with any questions!
scottwilson
You can add "pre-populate the grid with JSON" as an upcoming feature. It's something I'm working on across all of the grids that will be easy to reuse.

This will make it a lot easier to set up some known maps that won't die out after a few generations.

Another hidden feature that is a side effect of some other work I did... is that if you set up a stopInput (digital input), then you can pause playback and populate the grid without it running. Then toggle the stopInput again and it'll start running from there.

-s
a scanner darkly
Cool, added, nice feature to have.

Pausing is a cool feature to have too, but I'm already using all of the digital inputs :-) you can alternatively do that when slaving to external clock by putting the digital input switch to central position.
scottwilson
Yeah, this is an optional parameter I made on clock-based devices. I was wondering about that as I read your digital input list, but my brain is fried and I couldn't quite add them all up.

s
a scanner darkly
I was debating whether to support assigning different digital inputs but in the end decided it's not likely anybody would need that flexibility, considering that each digital input is used for something. The only exception is the external clock input can still be assigned to any digital input, but i have a feeling you might refactor that whole area on how the clocks are initialized so decided it's best to leave it as is for now.

So yeah, every digital input other than DUE_IN_D0 is assigned to something. The sketch itself then assigns DUE_IN_D0 as the external clock.
a scanner darkly
This is the current assignment of the inputs:

digital inputs:
1 - external clock
2 - create new cell
3 - reseed the grid with random colony
4 - when low uses the classic rules, when high the rules are CV controlled
5 - shift left
6 - shift right
7 - shift up
8 - shift down

analog inputs:
1 - tempo when using a VC clock
2 - CV control over the new cell shape
3 - X coordinate for new cells (when triggered by digital input 2)
4 - Y coordinate for new cells (when triggered by digital input 2)
5 - CV over minimal number of neighbours for new cells
6 - CV over maximum number of neighbours for new cells
7 - CV over minimal number of neighbours for old cells to survive
8 - CV over maximum number of neighbours for old cells to survive
9 - CV over the density of new random colonies (when triggered by digital input 3)

I'll add a bunch of comments to the code once I finish all the v1 features!
scottwilson
Makes plenty of sense. When you use all of the outputs, you may as well use the inputs to their fullest and simplify the config.
a scanner darkly
Getting close to completing all of the v1 features!

Added last night:
- ability to use a trigger to generate a new cell at the coordinates controlled by CV
- CV control over the rules
- switch between classic rules / CV rules with a gate
- gates out for when a colony gets too big / too small (try patching this into the random trigger in!)
- CV control over the density of randomly created colonies

I gotta say CV control over the rules is awesome. I expected it to be pretty random, especially when it's modulating itself, but I was getting some crazy cool patterns.

Here is another bad video but it shows you what it looks like when you start CVing the rules (I do switch between CV rules and classic rules several times). The CV outs are used to modulate everything (additionally going through 2 Wiard JAGs for 18 more modulation CVs...). There is also a lot of self modulation happening, some of the trigger outs are used to generate new cells or shift the colony, and the external clock itself is modulated by one of the CV outs.

(first 5 seconds are silent - fighting with the video editor...)

myecholalia
Holy... This is just so full of awesome.
a scanner darkly
Yeah, I sat like for 15 minutes just watching and listening to it :-) And I ran out of things to modulate, can't wait to pair it up with 4ms VCA Matrix and ADDAC Filterbank!

Gotta say, it should probably come with a warning that it can get pretty seizure inducing. With some voltage combination for the rules it goes into this "all LEDs on / all LEDs off" mode and get stuck there. This is the reason I included the gates out for "the colony is too big" / "the colony is too small" - they can be patched into the trigger for random so that if it gets into that state it just gets a new random pattern (the criteria for these is based on 1/16 of the total number of cells, so for grid 128 the "population too low" gate goes high when the number of active cells is less than 128/16 = 8 cells, and the "population too high" gate goes high when it's over 128 - 8 = 120 cells - that seemed like a reasonable threshold).
myecholalia
I will totally patch this into my ADDAC601 as well as the WMD SSM. This will for sure be awesome.
Holding off until Scott comes out with the official 1.1 firmware, though. No coding chops here (yet?), so can't build it myself.
scottwilson
Taking a bit longer for a pre-alpha build than I was hoping. I have OtoGrid, Game of Life, and the Probability Grid Trigger Sequencer working via JSON as of tonight, so only now have to set up the Note Sequencer and then at least the ones I've written so far will be done. (Couple more around the corner, but won't make you wait on that)

I should have a 1.1 firmware ready sometime this weekend.
myecholalia
Thanks, Scott. That'll be awesome. Will wait as long as it takes, and in the meantime finish building my DIY case to put everything into :-)
a scanner darkly
Yep, I'm hoping to finish the remaining v1 features tomorrow so that I can concentrate on my next grid/::b project (and rearranging the euro cases to have more stuff for the ::b to control...)
djthopa
@a scanner darkly.

This is just amazing. Thanks again for your time & effort on this one.

Seems im going to be asking a lot of questions next week about bee and the monome integration.

Im thinking of some simple sequencers. One 8 voice drum trigger with loop length and preset saving and a 8 voice note sequencer like on the white whale.

But to be honest i dont know where to start!


scottwilson wrote:
Taking a bit longer for a pre-alpha build than I was hoping. I have OtoGrid, Game of Life, and the Probability Grid Trigger Sequencer working via JSON as of tonight, so only now have to set up the Note Sequencer and then at least the ones I've written so far will be done. (Couple more around the corner, but won't make you wait on that)

I should have a 1.1 firmware ready sometime this weekend.


Scott that is amazing news! So glad i jumped on this! Cant wait to receive the bee next week!
a scanner darkly
Will be happy to help with any questions! Did you grab a USB-OTG adapter already? Also, unless you're planning to use the Monome ext5v thingy to power the grid make sure you've got enough 5v supply in your case.

For coding I was thinking of making a simple template for grid sketches that could be an easier starting point, I'll post it in the "Programming the grid" thread once I get around to it.
scottwilson
(from our earlier discussions) I think djthopa will be starting out with the SD-based firmware.

In which case, there's a lot built for you... The sample definition files are already set up and it's a matter of customizing them to your tastes. They are all available in the repo:

https://github.com/nw2s/b/tree/b-1.1.0-unstable/flash/programs/example s

For example, the game of life is just this:

Code:

{
   "program" :    
   {
      "name" :          "Game Of Life",
         
      "clock" :
      {
         "type" : "FixedClock",
         "tempo" : 120,
         "beats" : 16         
      },
      "devices" : [
         
         {
            "type" : "GameOfLife",
            "division" : "sixteenth",
            "columns" : 16,
            "rows" : 16,
            "varibright" : true,
            "deviceType" : "grids"
         }               
      ]
   }
}


if you want an external clock, then it looks like this... couple of small tweaks:

Code:

{
   "program" :    
   {
      "name" :          "Game Of Life",
         
      "devices" : [
         
         {
            "type" : "GameOfLife",
            "externalClock" : 1,
            "columns" : 16,
            "rows" : 16,
            "varibright" : true,
            "deviceType" : "grids"
         }               
      ]
   }
}
djthopa
a scanner darkly wrote:
Will be happy to help with any questions! Did you grab a USB-OTG adapter already? Also, unless you're planning to use the Monome ext5v thingy to power the grid make sure you've got enough 5v supply in your case.

For coding I was thinking of making a simple template for grid sketches that could be an easier starting point, I'll post it in the "Programming the grid" thread once I get around to it.


Thanks for your quick response. Yes, i think Scott was sending me a Usb-otg adapter. I have two of the ext 5v monome power supplies so ii should be good with that!

Sorry to be an absolutely noob on coding!

So Scott, all those files on the github/flash/programs/examples are like reference files i need to call (like game of life) when creating a new program code? So basically i would just have to point the program to load those reference files and i would not have to rewrite the whole thing. If its like that then most of the hard work is done thumbs up

Really appreciate both of your inputs. Thanks a lot
a scanner darkly
Yeah, basically here is what you would do in a nutshell:

- Open the github and select the branch you want (right now there are two, 1.0 and 1.1)
- If you just want to play with some code you can skip installing Git on your machine and just use "download zip"
- Unzip downloaded file to some folder
- Install Arduino IDE and in the settings point it to that folder

If everything was done correctly you should be able to see the nw2s sketches right from the Arduino IDE menu, and once you connect the ::b and set up the ports you can upload your sketches.

Once you do that and confirm you can upload a sketch I would just copy one of the existing sketches, rename it to something else and play with that. It will already include all the necessary references.
MUFF WIGGLER Forum Index -> nw2s Goto page 1, 2  Next [all]
Page 1 of 2
Powered by phpBB © phpBB Group