Handbook
Glossary
next-step ( grid -- )
Vocabulary
game-of-life
Inputs
grid
an
object
Outputs
None
Definition
USING:
arrays
bit-arrays
byte-arrays
kernel
kernel.private
math.order
sequences
sequences.private
;
IN:
game-of-life
::
next-step
( grid -- )
grid
count-neighbors
{
array
}
declare
:>
neighbors grid
{
array
}
declare
[|
row j |
j neighbors
nth-unsafe
{
byte-array
}
declare
:>
neighbor-row row
{
bit-array
}
declare
[|
cell i |
i neighbor-row
nth-unsafe
cell
[
2 3
between?
i row
set-nth-unsafe
]
[
3
=
[
t
i row
set-nth-unsafe
]
when
]
if
]
each-index
]
each-index
;