Skip to content

Commit

Permalink
fix(examples): update rule arrays/uniforms
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Aug 31, 2023
1 parent 34c3bd3 commit c9d42c2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/webgl-game-of-life/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const gameOfLife = defMultiPass({
format: TextureFormat.R8,
// pre-seed simulation with noise texture
image: new Uint8Array(
repeatedly(() => (SYSTEM.probability(0.4) ? -1 : 0), W * W)
repeatedly(() => (SYSTEM.probability(0.5) ? -1 : 0), W * W)
),
},
// interim buffer for next CA generation
Expand Down Expand Up @@ -86,8 +86,9 @@ void main() {
// CA simulation rules as look up tables for all possible neighbor counts
// enables easy experimentation with new rules...
// Game of Life rules: stay alive if 2 or 3, birth if 3 neighbors
alive: ["int[]", 8, [0, 0, 1, 1, 0, 0, 0, 0, 0]],
birth: ["int[]", 8, [0, 0, 0, 1, 0, 0, 0, 0, 0]],
// (require 9 states to cover outcomes for 0-8 neighbors)
alive: ["int[]", 9, [0, 0, 1, 1, 0, 0, 0, 0, 0]],
birth: ["int[]", 9, [0, 0, 0, 1, 0, 0, 0, 0, 0]],
},
},

Expand Down

0 comments on commit c9d42c2

Please sign in to comment.