//Modified Game of Life of Sequencer //Implements an eight-step, eight-voice //sequencer. Only one voice is expressed per step. //The more favored voices should be named with lower values. //(i.e. I have the samples I want to use named samp0.wav, samp1.wav //etc. so I put the ones I want more of at 0,1,2...) //After the end of eight steps, the grid evolves based on the //rules of John Conway's Game of Life...living cells with //more than three or fewer than two neighbors die, and dead cells //with exactly three neighbors come to life. int world[8][8]; SndBuf b => dac; 0 @=> int gen; int count; //initialize world for (int i; i<8; i++) { for (int j;j<8;j++) { Std.rand2(0,1) => world[i][j]; } } while(true) { //Check the column for the first active voice, load it, and play. for(int i;i<8;i++) { if (world[i][gen]==1){ "C:/samp" + i + ".wav" => b.read; 8 => i; } 0 => b.pos; Std.rand2f(0.9,1.1) => b.rate; 250::ms=>now; (gen+1)%8 => gen; <<>>; if (gen==0) { //At the end of the bar, apply the game of life rule. for (int i; i<8; i++) { for (int j; j<8; j++) { world[(i+7)%8][(j+7)%8]+world[(i+7)%8][j] + world[(i+7)%8][(j+1)%8] + world[i][(j+7)%8] + world[i][(j+1)%8] + world[(i+1)%8][(j+7)%8] +world[(i+1)%8][(j+1)%8] =>count; if (world[i][j]==1 && count<2) { 0 => world[i][j]; } else if (world[i][j]==1 && count>3) { 0 => world[i][j]; } else if (world[i][j]==0 && count==3) { 1 => world[i][j]; } } } } } }