Learn
Practice
Interview
Resources
Newsletter
F
Toggle theme
0
F
0
Toggle menu
Animations
← Back to All Animations
Game of Life
Bookmark
Brute Force
State Encoding
Bit Manipulation
Input
Glider
Blinker
Block (Still Life)
Beacon
Custom
board
=
[[0,1,0],[0,0,1],[1,1,1],[0,0,0]]
GEN 0
COPY BOARD
0
1
0
0
0
1
1
1
1
0
0
0
RULES
alive + 2 or 3 live -> survives
dead + exactly 3 live -> born
otherwise -> dies / stays dead
NEIGHBORS
FROZEN COPY
read the copy, write the board
read the copy, write the board
GEN 0
COPY BOARD
0
1
0
0
0
1
1
1
1
0
0
0
RULES
alive + 2 or 3 live -> survives
dead + exactly 3 live -> born
otherwise -> dies / stays dead
NEIGHBORS
FROZEN COPY
read the copy, write the board
read the copy, write the board
GEN 0
COPY BOARD
0
1
0
0
0
1
1
1
1
0
0
0
RULES
alive + 2 or 3 live -> survives
dead + exactly 3 live -> born
otherwise -> dies / stays dead
NEIGHBORS
cell (0, 0)
1
LIVE
FROZEN COPY
board[0][0] = 0
0
next
stays dead
GEN 0
COPY BOARD
0
0
0
0
0
1
1
1
1
0
0
0
RULES
alive + 2 or 3 live -> survives
dead + exactly 3 live -> born
otherwise -> dies / stays dead
NEIGHBORS
cell (0, 2)
2
LIVE
FROZEN COPY
board[0][2] = 0
0
next
cell (0, 2): 2 live neighbors
GEN 0
COPY BOARD
0
0
0
1
0
1
1
1
1
0
0
0
RULES
alive + 2 or 3 live -> survives
dead + exactly 3 live -> born
otherwise -> dies / stays dead
NEIGHBORS
cell (1, 0)
3
LIVE
FROZEN COPY
board[1][0] = 1
1
next
born, board cell set to 1
GEN 0
COPY BOARD
0
0
0
1
0
1
1
1
1
0
0
0
RULES
alive + 2 or 3 live -> survives
dead + exactly 3 live -> born
otherwise -> dies / stays dead
NEIGHBORS
cell (1, 2)
3
LIVE
FROZEN COPY
board[1][2] = 0
0
next
cell (1, 2): 3 live neighbors
GEN 0
COPY BOARD
0
0
0
1
0
1
1
1
1
0
0
0
RULES
alive + 2 or 3 live -> survives
dead + exactly 3 live -> born
otherwise -> dies / stays dead
NEIGHBORS
cell (2, 0)
1
LIVE
FROZEN COPY
board[2][0] = 1
1
next
cell (2, 0): 1 live neighbor
GEN 0
COPY BOARD
0
0
0
1
0
1
0
1
1
0
0
0
RULES
alive + 2 or 3 live -> survives
dead + exactly 3 live -> born
otherwise -> dies / stays dead
NEIGHBORS
cell (2, 1)
3
LIVE
FROZEN COPY
board[2][1] = 1
1
next
survives, board cell left alone
GEN 0
COPY BOARD
0
0
0
1
0
1
0
1
1
0
0
0
RULES
alive + 2 or 3 live -> survives
dead + exactly 3 live -> born
otherwise -> dies / stays dead
NEIGHBORS
cell (3, 0)
2
LIVE
FROZEN COPY
board[3][0] = 1
1
next
cell (3, 0): 2 live neighbors
GEN 0
COPY BOARD
0
0
0
1
0
1
0
1
1
0
1
0
RULES
alive + 2 or 3 live -> survives
dead + exactly 3 live -> born
otherwise -> dies / stays dead
NEIGHBORS
cell (3, 1)
3
LIVE
FROZEN COPY
board[3][1] = 1
1
next
born, board cell set to 1
GEN 1
COPY BOARD
0
0
0
1
0
1
0
1
1
0
1
0
RULES
alive + 2 or 3 live -> survives
dead + exactly 3 live -> born
otherwise -> dies / stays dead
NEIGHBORS
cell (3, 2)
2
LIVE
FROZEN COPY
board[3][2] = 0
0
next
next generation ready
algo
master
.
io
Step:
Start: copy the board, then write the next generation into the original
0 / 26
Input
Glider
Blinker
Block (Still Life)
Beacon
Custom
board
=
[[0,1,0],[0,0,1],[1,1,1],[0,0,0]]
0 / 26
algo
master
.
io
Step:
Start: copy the board, then write the next generation into the original