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
68
69
70
71
//! What the Conway sims share: the [`ConwaySim`] trait that drives them,
//! the [`ConwayRules`] a 3D sim steps by, and [`slices`], helpers that read
//! and write rectangles of a 2D board.
use Range;
use Device;
use ;
/// Common control for Conway's Game of Life sims.
///
/// Implemented by [`ConwayLife2DState`] and [`ConwayLife3DState`]. Both
/// step in place; the kernels behind them are in
/// [`conway::ops`](super::ops).
///
/// [`ConwayLife2DState`]: super::life2d::ConwayLife2DState
/// [`ConwayLife3DState`]: super::life3d::ConwayLife3DState
/// Life Rulesets.
///
/// A cell's neighbours are the live cells around it, not counting itself.
/// A dead cell with a neighbour count in `spawn` is born, and a live cell
/// with a count in `keep` survives; every other cell is dead next
/// generation. The default, `spawn: 3..4` and `keep: 2..4`, is the
/// standard B3/S23. Only [`ConwayLife3DConfig`] takes rules; the 2D sim's
/// rule is fixed at B3/S23.
///
/// [`ConwayLife3DConfig`]: super::life3d::ConwayLife3DConfig