Skip to content

Commit

Permalink
Initialize with random cell states.
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuacc committed Nov 12, 2011
1 parent aaa1137 commit 8c6ecd2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lifeforce.coffee.js
Expand Up @@ -6,10 +6,13 @@ l_context = l_canvas.getContext "2d"
l_context.fillStyle = "#fff"
l_context.fillRect 0, 0, 640, 360

# Initialize a 2d array as entirely dead
# Initialize a 2d array
# False represents a "dead" cell, while true represents a "live" cell
l =
for x in [0..639]
false for y in [0..359]
for y in [0..359]
randomnum = Math.floor(Math.random() * 2)
!!randomnum

console.log l

console.log l

0 comments on commit 8c6ecd2

Please sign in to comment.