From: Leighton Wallace Date: Sun, 24 Nov 2013 02:35:08 +0000 (-0800) Subject: Life redux X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1c56d2f1bbb47cb106d54b8d9472e4bf814c5d3c;p=SugarCubes.git Life redux --- diff --git a/L8onWallace.pde b/L8onWallace.pde index 63bd474..031a083 100644 --- a/L8onWallace.pde +++ b/L8onWallace.pde @@ -22,7 +22,7 @@ class Life extends SCPattern { public Life(GLucose glucose) { super(glucose); - //outputCubeInfo(); + outputCubeInfo(); initCubeStates(); time_since_last_run = 0; any_changes_this_run = false; @@ -79,8 +79,7 @@ class Life extends SCPattern { for (Cube c : model.cubes) { neighbors = findCubeNeighbors(c, i); - alive = (i % 6 == 0); -// alive = true; + alive = true; cube_state = new CubeState(i, alive, neighbors); this.cube_states.add(cube_state); ++i; @@ -88,8 +87,13 @@ class Life extends SCPattern { } private void randomizeCubeStates() { - for (CubeState cube_state: this.cube_states) { - if( (cube_state.index % 2 == 0) == cube_state.alive) { + print("randomizing!\n"); + + float f = (xPos.getValuef() / model.xMax) * 10; + int mod_value = max(2, (int) f); + + for (CubeState cube_state: this.cube_states) { + if( (cube_state.index % mod_value == 0) == cube_state.alive) { cube_state.alive = !cube_state.alive; } } @@ -106,6 +110,7 @@ class Life extends SCPattern { } if(abs(c.x - cube.x) < (Cube.EDGE_WIDTH * 2) && abs(c.y - cube.y) < (Cube.EDGE_HEIGHT * 2)) { + print("Cube " + i + " is a neighbor of " + index + "\n"); neighbors.add(i); } diff --git a/SugarCubes.pde b/SugarCubes.pde index 2c9ecab..d4aa68f 100644 --- a/SugarCubes.pde +++ b/SugarCubes.pde @@ -25,7 +25,7 @@ LXPattern[] patterns(GLucose glucose) { return new LXPattern[] { - + new SineSphere(glucose), //new CubeCurl(glucose), @@ -91,7 +91,7 @@ LXPattern[] patterns(GLucose glucose) { // Jack new Swim(glucose), new Balance(glucose), - + // L8on new Life(glucose),