1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
.Dd September 27, 2021
.Dt CGOL 1
.Os "ben's space"
.Sh NAME
.Nm cgol
.Nd generate images of the game of life
.Sh SYNOPSIS
.Nm
.Op Ar width height Op Ar gens | 0
.Sh DESCRIPTION
.Nm
generates frames of the progression of the game of life as images,
placed into the
.Pa images/
directory.
.Nm
begins with a
.Xr randomize 3 Ns d grid of cells,
which are
.Xr evolve 3 Ns d according to the following rules:
.Bl -dash -offset indent
.It
A
.Qq dead
cell with exactly 3 neighbours becomes
.Qq alive .
.It
A
.Qq living
cell remains living only if it has 2 or 3 neighbours.
.It
All other cells remain or become dead.
.El
According to these rules, the random initial state can give rise to
some interesting behaviours.
.Pp
Options:
.Bl -tag -width Ds
.It Ar width height
the width and height of the images to be printed, in pixels.
.It Ar gens
the number of generations to evolve. Must be 0 < gens <= 999999.
However, if
.Ar gens
is 0,
.Nm
will run until there are 4 consecutive generations without a change
in population.
.El
.Ss Creating a video from the images
Using a tool such as
.Xr ffmpeg 1 ,
the following command would create a video
.Pa out.webm
at
.Ar 15
frames per second
from the images stored in
.Pa images/ :
.Bd -offset indent
ffmpeg
.Fl r Ar 15
.Fl i Ar images/%04d.png
.Ar out.webm
.Ed
.Sh AUTHORS
.An phoebos Aq Mt ben@bvnf.space
|