Игра Жизни Конвея
Правила
Место действия этой игры — «вселенная» — это размеченная на клетки поверхность, безграничная, ограниченная, или замкнутая. В компьютерных реализациях игры чаще всего используют поверхность тора. Каждая клетка на этой поверхности может находиться в двух состояниях: быть живой или быть мёртвой. Клетка имеет восемь соседей. Распределение живых клеток в начале игры называется первым поколением. Каждое следующее поколение рассчитывается на основе предыдущего по таким правилам:
- пустая (мёртвая) клетка рядом с тремя живыми клетками-соседями оживает;
- если у живой клетки есть две или три живые соседки, то эта клетка продолжает жить; в противном случае (если соседей меньше двух или больше трёх) клетка умирает (от «одиночества» или от «перенаселённости»).
Игрок не принимает прямого участия в игре, а лишь расставляет «живые» клетки, которые взаимодействуют согласно правилам уже без его участия.
Эти простые правила приводят к огромному разнообразию форм, которые могут возникнуть в игре.
The Shape of the World
In principle, the Life universe is an infinite grid. In practice, implementations generally impose some constraints. This implementation allows you to configure those constraints at any time, even as the universe is evolving.
Topology
You can choose among three topologies:
- Closed — the universe has edges beyond which no cells can be born. Cells along the edges have fewer than eight neighbors.
- Wrap — the edges of the universe wrap around, so that the top is connected to the bottom, and the right is connected to the left.
- Open — the universe has no edges and can grow without bound.
Width and Height
You can set the width and height to any reasonable integer values. If you specify a non-numeric value, or a value which is too large or too small, the default value will be used instead.
Color
You can choose among four color schemes:
- Black — all new cells are black.
- Rainbow — the color used for new cells changes from generation to generation, following a rainbow sequence. Old cells retain whatever color they were created with.
- RGB — all new cells are created with the color whose RGB (red/green/blue) values you specify, ranging from 0 to 255. For example, RGB values of 255,0,0 would denote red, while 0,255,255 would be cyan.
- Hybrid RGB — newly-inserted cells are created as with the RGB color scheme. Cells born as the world evolves acquire their color as an average of the colors of their three parent cells.