mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 00:01:37 +08:00
moved glider to the bottom
This commit is contained in:
@ -15,18 +15,6 @@ The Game of Life is a cellular automaton devised by the British mathematician Jo
|
||||
* [ [ 0, 0, 0 ], [ 1, 1, 1 ], [ 0, 0, 0 ] ]
|
||||
*/
|
||||
|
||||
// Define glider example
|
||||
const glider = [
|
||||
[0, 1, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 1, 0, 0, 0, 0, 0],
|
||||
[1, 1, 1, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0]
|
||||
]
|
||||
|
||||
/*
|
||||
* Generates the next generation for a given state of Conway's Game of Life.
|
||||
*/
|
||||
@ -87,4 +75,16 @@ async function animate (cells, steps) {
|
||||
}
|
||||
}
|
||||
|
||||
// Define glider example
|
||||
const glider = [
|
||||
[0, 1, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 1, 0, 0, 0, 0, 0],
|
||||
[1, 1, 1, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0, 0, 0]
|
||||
]
|
||||
|
||||
animate(glider, 16)
|
||||
|
Reference in New Issue
Block a user