lifegrid 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lifegrid-2.0.0/CODE_OF_CONDUCT.md +150 -0
- lifegrid-2.0.0/LICENSE +21 -0
- lifegrid-2.0.0/MANIFEST.in +6 -0
- lifegrid-2.0.0/PKG-INFO +187 -0
- lifegrid-2.0.0/README.md +152 -0
- lifegrid-2.0.0/docs/COMPREHENSIVE_USER_GUIDE.md +796 -0
- lifegrid-2.0.0/docs/DEVELOPMENT.md +148 -0
- lifegrid-2.0.0/docs/USER_GUIDE.md +174 -0
- lifegrid-2.0.0/examples/README.md +15 -0
- lifegrid-2.0.0/lifegrid.egg-info/PKG-INFO +187 -0
- lifegrid-2.0.0/lifegrid.egg-info/SOURCES.txt +37 -0
- lifegrid-2.0.0/lifegrid.egg-info/dependency_links.txt +1 -0
- lifegrid-2.0.0/lifegrid.egg-info/entry_points.txt +2 -0
- lifegrid-2.0.0/lifegrid.egg-info/requires.txt +8 -0
- lifegrid-2.0.0/lifegrid.egg-info/top_level.txt +1 -0
- lifegrid-2.0.0/pyproject.toml +63 -0
- lifegrid-2.0.0/requirements.txt +4 -0
- lifegrid-2.0.0/setup.cfg +4 -0
- lifegrid-2.0.0/src/automata/__init__.py +26 -0
- lifegrid-2.0.0/src/automata/ant.py +51 -0
- lifegrid-2.0.0/src/automata/base.py +28 -0
- lifegrid-2.0.0/src/automata/briansbrain.py +59 -0
- lifegrid-2.0.0/src/automata/conway.py +371 -0
- lifegrid-2.0.0/src/automata/generations.py +98 -0
- lifegrid-2.0.0/src/automata/highlife.py +67 -0
- lifegrid-2.0.0/src/automata/immigration.py +91 -0
- lifegrid-2.0.0/src/automata/lifelike.py +101 -0
- lifegrid-2.0.0/src/automata/rainbow.py +113 -0
- lifegrid-2.0.0/src/automata/wireworld.py +71 -0
- lifegrid-2.0.0/src/gui/__init__.py +5 -0
- lifegrid-2.0.0/src/gui/app.py +1160 -0
- lifegrid-2.0.0/src/gui/config.py +97 -0
- lifegrid-2.0.0/src/gui/rendering.py +70 -0
- lifegrid-2.0.0/src/gui/state.py +155 -0
- lifegrid-2.0.0/src/gui/ui.py +490 -0
- lifegrid-2.0.0/src/main.py +47 -0
- lifegrid-2.0.0/src/patterns.py +130 -0
- lifegrid-2.0.0/src/version.py +5 -0
- lifegrid-2.0.0/tests/test_gui.py +79 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# LifeGrid Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to make participation in the LifeGrid
|
|
7
|
+
project a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and
|
|
9
|
+
expression, level of experience, education, socio-economic status, nationality,
|
|
10
|
+
personal appearance, race, religion, or sexual identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
### Positive Behavior
|
|
18
|
+
|
|
19
|
+
Examples of behavior that contributes to creating a positive environment
|
|
20
|
+
include:
|
|
21
|
+
|
|
22
|
+
* Using welcoming and inclusive language
|
|
23
|
+
* Being respectful of differing viewpoints and experiences
|
|
24
|
+
* Gracefully accepting constructive criticism
|
|
25
|
+
* Focusing on what is best for the community
|
|
26
|
+
* Showing empathy towards other community members
|
|
27
|
+
* Helping newcomers learn and grow
|
|
28
|
+
* Celebrating the successes of others
|
|
29
|
+
|
|
30
|
+
### Unacceptable Behavior
|
|
31
|
+
|
|
32
|
+
Examples of unacceptable behavior include:
|
|
33
|
+
|
|
34
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
35
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
36
|
+
* Public or private harassment
|
|
37
|
+
* Publishing others' private information without explicit permission
|
|
38
|
+
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
39
|
+
|
|
40
|
+
## Our Responsibilities
|
|
41
|
+
|
|
42
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
43
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
44
|
+
response to any instances of unacceptable behavior.
|
|
45
|
+
|
|
46
|
+
Project maintainers have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
|
|
49
|
+
contributor for other behaviors that they deem inappropriate, threatening,
|
|
50
|
+
offensive, or harmful.
|
|
51
|
+
|
|
52
|
+
## Scope
|
|
53
|
+
|
|
54
|
+
This Code of Conduct applies within all project spaces, and it also applies when
|
|
55
|
+
an individual is representing the project or its community in public spaces.
|
|
56
|
+
Examples of representing the project include using an official project e-mail
|
|
57
|
+
address, posting via an official social media account, or acting as an appointed
|
|
58
|
+
representative at an online or offline event.
|
|
59
|
+
|
|
60
|
+
## Learning and Exploration Context
|
|
61
|
+
|
|
62
|
+
LifeGrid is designed to help people explore cellular automata and
|
|
63
|
+
simulation concepts. We place special emphasis on:
|
|
64
|
+
|
|
65
|
+
* Creating a welcoming environment for experimentation and curiosity
|
|
66
|
+
* Encouraging questions about simulations, algorithms, and tooling
|
|
67
|
+
* Treating mistakes as learning opportunities
|
|
68
|
+
* Providing constructive, encouraging feedback
|
|
69
|
+
* Respecting the privacy and safety of all participants
|
|
70
|
+
|
|
71
|
+
## Enforcement
|
|
72
|
+
|
|
73
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
74
|
+
reported by contacting the project team at james@honey-badger.org. All
|
|
75
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
76
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
77
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
|
78
|
+
incident. Further details of specific enforcement policies may be posted
|
|
79
|
+
separately.
|
|
80
|
+
|
|
81
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
82
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
83
|
+
members of the project's leadership.
|
|
84
|
+
|
|
85
|
+
## Enforcement Guidelines
|
|
86
|
+
|
|
87
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
88
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
89
|
+
|
|
90
|
+
### 1. Correction
|
|
91
|
+
|
|
92
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
93
|
+
unprofessional or unwelcome.
|
|
94
|
+
|
|
95
|
+
**Consequence**: A private, written warning, providing clarity around the nature
|
|
96
|
+
of the violation and an explanation of why the behavior was inappropriate. A
|
|
97
|
+
public apology may be requested.
|
|
98
|
+
|
|
99
|
+
### 2. Warning
|
|
100
|
+
|
|
101
|
+
**Community Impact**: A violation through a single incident or series of
|
|
102
|
+
actions.
|
|
103
|
+
|
|
104
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
105
|
+
interaction with the people involved for a specified period of time. This
|
|
106
|
+
includes avoiding interactions in community spaces as well as external
|
|
107
|
+
channels. Violating these terms may lead to a temporary or permanent ban.
|
|
108
|
+
|
|
109
|
+
### 3. Temporary Ban
|
|
110
|
+
|
|
111
|
+
**Community Impact**: A serious violation of community standards, including
|
|
112
|
+
sustained inappropriate behavior.
|
|
113
|
+
|
|
114
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
115
|
+
communication with the community for a specified period of time. No public or
|
|
116
|
+
private interaction with the people involved is allowed during this period.
|
|
117
|
+
Violating these terms may lead to a permanent ban.
|
|
118
|
+
|
|
119
|
+
### 4. Permanent Ban
|
|
120
|
+
|
|
121
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
122
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
123
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
124
|
+
|
|
125
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
126
|
+
community.
|
|
127
|
+
|
|
128
|
+
## Attribution
|
|
129
|
+
|
|
130
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
131
|
+
version 2.0, available at
|
|
132
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
133
|
+
|
|
134
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
135
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
136
|
+
|
|
137
|
+
[homepage]: https://www.contributor-covenant.org
|
|
138
|
+
|
|
139
|
+
For answers to common questions about this code of conduct, see
|
|
140
|
+
https://www.contributor-covenant.org/faq.
|
|
141
|
+
|
|
142
|
+
## Contact
|
|
143
|
+
|
|
144
|
+
For questions or concerns about this Code of Conduct, please contact:
|
|
145
|
+
|
|
146
|
+
**James Temple**
|
|
147
|
+
Honey Badger Universe
|
|
148
|
+
Email: james@honey-badger.org
|
|
149
|
+
Project: LifeGrid
|
|
150
|
+
GitHub: https://github.com/James-HoneyBadger/LifeGrid
|
lifegrid-2.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Honey Badger Universe
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
lifegrid-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: lifegrid
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: An interactive Tkinter-based workbench for experimenting with cellular automata
|
|
5
|
+
Author-email: James-HoneyBadger <your-email@example.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/James-HoneyBadger/LifeGrid
|
|
8
|
+
Project-URL: Repository, https://github.com/James-HoneyBadger/LifeGrid.git
|
|
9
|
+
Project-URL: Documentation, https://github.com/James-HoneyBadger/LifeGrid/tree/master/docs
|
|
10
|
+
Project-URL: Issues, https://github.com/James-HoneyBadger/LifeGrid/issues
|
|
11
|
+
Keywords: cellular-automata,conway-game-of-life,tkinter,simulation,interactive
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Natural Language :: English
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.13
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: numpy>=1.24.0
|
|
28
|
+
Requires-Dist: scipy>=1.11.0
|
|
29
|
+
Requires-Dist: Pillow>=10.0.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.4.0; extra == "dev"
|
|
32
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pylint>=2.17.0; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
Repository: https://github.com/James-HoneyBadger/LifeGrid
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+

|
|
40
|
+

|
|
41
|
+

|
|
42
|
+
git clone https://github.com/James-HoneyBadger/LifeGrid.git
|
|
43
|
+
## LifeGrid
|
|
44
|
+
|
|
45
|
+
An interactive Tkinter-based workbench for experimenting with cellular
|
|
46
|
+
automata. The simulator ships with several classic rules, a custom B/S rule
|
|
47
|
+
editor, drawing tools, and quick exporting to PNG.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Highlights
|
|
52
|
+
|
|
53
|
+
- **Multiple automata**: Conway's Life, HighLife, Immigration, Rainbow,
|
|
54
|
+
Langton's Ant, and fully custom life-like rules.
|
|
55
|
+
- **Pattern presets** per mode for quick experimentation.
|
|
56
|
+
- **Drawing tools** with toggle/pen/eraser modes plus symmetry helpers.
|
|
57
|
+
- **Live statistics** for population deltas, peaks, and density.
|
|
58
|
+
- **Save/Load** patterns as JSON and **export PNG** snapshots (when Pillow is
|
|
59
|
+
installed).
|
|
60
|
+
- **Keyboard shortcuts**: `Space` (start/stop), `S` (step), `Left` (step back),
|
|
61
|
+
`C` (clear), `G` (toggle grid).
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Requirements
|
|
66
|
+
|
|
67
|
+
- Python 3.13+
|
|
68
|
+
- Tkinter (bundled with most Python installations)
|
|
69
|
+
- NumPy 1.24+
|
|
70
|
+
- SciPy 1.11+ (used for fast convolutions)
|
|
71
|
+
- Pillow 10+ (optional, enables PNG export)
|
|
72
|
+
|
|
73
|
+
Install dependencies from the repository root:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install -r requirements.txt
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Getting Started
|
|
82
|
+
|
|
83
|
+
Run LifeGrid from the project root:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
python src/main.py
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Or use the helper script on Unix-like systems:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
./run.sh
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Quick workflow**
|
|
96
|
+
1. Pick a mode from the **Mode** dropdown.
|
|
97
|
+
2. Choose a **Pattern** or draw on the canvas.
|
|
98
|
+
3. Press **Start** (or hit `Space`) to run the simulation.
|
|
99
|
+
4. Adjust **Speed**, drawing tools, and symmetry as needed.
|
|
100
|
+
5. Use **Settings → Grid & View Settings…** for grid size, cell size, and grid
|
|
101
|
+
lines.
|
|
102
|
+
6. Save/load/export from the **File** menu.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Controls at a Glance
|
|
107
|
+
|
|
108
|
+
| Action | UI Control | Shortcut |
|
|
109
|
+
| --- | --- | --- |
|
|
110
|
+
| Start/Stop simulation | Start button | `Space` |
|
|
111
|
+
| Step one generation | Step button | `S` |
|
|
112
|
+
| Step back one generation | Back button | `Left` |
|
|
113
|
+
| Clear grid | Simulation → Clear | `C` |
|
|
114
|
+
| Toggle grid lines | Settings → Toggle Grid | `G` |
|
|
115
|
+
| Resize grid | Settings → Grid & View Settings… | – |
|
|
116
|
+
| Apply custom B/S rule | Settings → Custom Rules… | – |
|
|
117
|
+
|
|
118
|
+
Mouse interactions:
|
|
119
|
+
|
|
120
|
+
- Click to toggle/draw/erase (depends on draw mode).
|
|
121
|
+
- Drag while in Pen or Eraser to paint continuously.
|
|
122
|
+
- Symmetry options mirror strokes across selected axes.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Available Modes & Patterns
|
|
127
|
+
|
|
128
|
+
- **Conway's Game of Life**: Classic Mix, Glider Gun, Spaceships, Oscillators,
|
|
129
|
+
Puffers, R-Pentomino, Acorn, Random Soup.
|
|
130
|
+
- **HighLife (B36/S23)**: Replicator, Random Soup.
|
|
131
|
+
- **Immigration Game**: Color Mix, Random Soup.
|
|
132
|
+
- **Rainbow Game**: Rainbow Mix, Random Soup.
|
|
133
|
+
- **Langton's Ant**: Empty.
|
|
134
|
+
- **Custom Rules**: Random Soup starter pattern plus editable life-like B/S
|
|
135
|
+
rules via Settings.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Project Structure
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
LifeGrid/
|
|
143
|
+
├── src/
|
|
144
|
+
│ ├── automata/ # Automaton implementations
|
|
145
|
+
│ ├── gui/ # GUI modules (app, config, state, ui, rendering)
|
|
146
|
+
│ └── main.py # Thin entry point (delegates to gui.app)
|
|
147
|
+
├── docs/ # README-style documentation
|
|
148
|
+
├── examples/ # Sample patterns
|
|
149
|
+
├── tests/ # Unit tests
|
|
150
|
+
├── requirements.txt
|
|
151
|
+
├── run.sh
|
|
152
|
+
├── LICENSE
|
|
153
|
+
└── README.md
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Key GUI modules:
|
|
157
|
+
|
|
158
|
+
- `gui/app.py`: High-level application orchestration.
|
|
159
|
+
- `gui/ui.py`: Widget construction and event wiring.
|
|
160
|
+
- `gui/state.py`: Mutable simulation state container.
|
|
161
|
+
- `gui/config.py`: Shared constants and mode registries.
|
|
162
|
+
- `gui/rendering.py`: Canvas drawing helpers.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Development Notes
|
|
167
|
+
|
|
168
|
+
- Launch tests with `pytest`. Current coverage targets the Conway automaton;
|
|
169
|
+
extending coverage for other modes is encouraged.
|
|
170
|
+
- `flake8` enforces an 80-character line limit; run `flake8 src tests` before
|
|
171
|
+
committing.
|
|
172
|
+
- To add a new automaton, implement it under `src/automata/`, expose it from
|
|
173
|
+
`automata/__init__.py`, and register it in `gui/config.py`.
|
|
174
|
+
- The GUI is intentionally modular: prefer adding features in dedicated helper
|
|
175
|
+
modules rather than growing `gui/app.py`.
|
|
176
|
+
|
|
177
|
+
Further details can be found in:
|
|
178
|
+
|
|
179
|
+
- `docs/USER_GUIDE.md` – end-user walkthrough.
|
|
180
|
+
- `docs/DEVELOPMENT.md` – contributor guidelines and code map.
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
This project is distributed under the MIT License. See the `LICENSE` file for
|
|
187
|
+
full terms.
|
lifegrid-2.0.0/README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Repository: https://github.com/James-HoneyBadger/LifeGrid
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+
git clone https://github.com/James-HoneyBadger/LifeGrid.git
|
|
8
|
+
## LifeGrid
|
|
9
|
+
|
|
10
|
+
An interactive Tkinter-based workbench for experimenting with cellular
|
|
11
|
+
automata. The simulator ships with several classic rules, a custom B/S rule
|
|
12
|
+
editor, drawing tools, and quick exporting to PNG.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Highlights
|
|
17
|
+
|
|
18
|
+
- **Multiple automata**: Conway's Life, HighLife, Immigration, Rainbow,
|
|
19
|
+
Langton's Ant, and fully custom life-like rules.
|
|
20
|
+
- **Pattern presets** per mode for quick experimentation.
|
|
21
|
+
- **Drawing tools** with toggle/pen/eraser modes plus symmetry helpers.
|
|
22
|
+
- **Live statistics** for population deltas, peaks, and density.
|
|
23
|
+
- **Save/Load** patterns as JSON and **export PNG** snapshots (when Pillow is
|
|
24
|
+
installed).
|
|
25
|
+
- **Keyboard shortcuts**: `Space` (start/stop), `S` (step), `Left` (step back),
|
|
26
|
+
`C` (clear), `G` (toggle grid).
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
- Python 3.13+
|
|
33
|
+
- Tkinter (bundled with most Python installations)
|
|
34
|
+
- NumPy 1.24+
|
|
35
|
+
- SciPy 1.11+ (used for fast convolutions)
|
|
36
|
+
- Pillow 10+ (optional, enables PNG export)
|
|
37
|
+
|
|
38
|
+
Install dependencies from the repository root:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install -r requirements.txt
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Getting Started
|
|
47
|
+
|
|
48
|
+
Run LifeGrid from the project root:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python src/main.py
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Or use the helper script on Unix-like systems:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
./run.sh
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Quick workflow**
|
|
61
|
+
1. Pick a mode from the **Mode** dropdown.
|
|
62
|
+
2. Choose a **Pattern** or draw on the canvas.
|
|
63
|
+
3. Press **Start** (or hit `Space`) to run the simulation.
|
|
64
|
+
4. Adjust **Speed**, drawing tools, and symmetry as needed.
|
|
65
|
+
5. Use **Settings → Grid & View Settings…** for grid size, cell size, and grid
|
|
66
|
+
lines.
|
|
67
|
+
6. Save/load/export from the **File** menu.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Controls at a Glance
|
|
72
|
+
|
|
73
|
+
| Action | UI Control | Shortcut |
|
|
74
|
+
| --- | --- | --- |
|
|
75
|
+
| Start/Stop simulation | Start button | `Space` |
|
|
76
|
+
| Step one generation | Step button | `S` |
|
|
77
|
+
| Step back one generation | Back button | `Left` |
|
|
78
|
+
| Clear grid | Simulation → Clear | `C` |
|
|
79
|
+
| Toggle grid lines | Settings → Toggle Grid | `G` |
|
|
80
|
+
| Resize grid | Settings → Grid & View Settings… | – |
|
|
81
|
+
| Apply custom B/S rule | Settings → Custom Rules… | – |
|
|
82
|
+
|
|
83
|
+
Mouse interactions:
|
|
84
|
+
|
|
85
|
+
- Click to toggle/draw/erase (depends on draw mode).
|
|
86
|
+
- Drag while in Pen or Eraser to paint continuously.
|
|
87
|
+
- Symmetry options mirror strokes across selected axes.
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Available Modes & Patterns
|
|
92
|
+
|
|
93
|
+
- **Conway's Game of Life**: Classic Mix, Glider Gun, Spaceships, Oscillators,
|
|
94
|
+
Puffers, R-Pentomino, Acorn, Random Soup.
|
|
95
|
+
- **HighLife (B36/S23)**: Replicator, Random Soup.
|
|
96
|
+
- **Immigration Game**: Color Mix, Random Soup.
|
|
97
|
+
- **Rainbow Game**: Rainbow Mix, Random Soup.
|
|
98
|
+
- **Langton's Ant**: Empty.
|
|
99
|
+
- **Custom Rules**: Random Soup starter pattern plus editable life-like B/S
|
|
100
|
+
rules via Settings.
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Project Structure
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
LifeGrid/
|
|
108
|
+
├── src/
|
|
109
|
+
│ ├── automata/ # Automaton implementations
|
|
110
|
+
│ ├── gui/ # GUI modules (app, config, state, ui, rendering)
|
|
111
|
+
│ └── main.py # Thin entry point (delegates to gui.app)
|
|
112
|
+
├── docs/ # README-style documentation
|
|
113
|
+
├── examples/ # Sample patterns
|
|
114
|
+
├── tests/ # Unit tests
|
|
115
|
+
├── requirements.txt
|
|
116
|
+
├── run.sh
|
|
117
|
+
├── LICENSE
|
|
118
|
+
└── README.md
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Key GUI modules:
|
|
122
|
+
|
|
123
|
+
- `gui/app.py`: High-level application orchestration.
|
|
124
|
+
- `gui/ui.py`: Widget construction and event wiring.
|
|
125
|
+
- `gui/state.py`: Mutable simulation state container.
|
|
126
|
+
- `gui/config.py`: Shared constants and mode registries.
|
|
127
|
+
- `gui/rendering.py`: Canvas drawing helpers.
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Development Notes
|
|
132
|
+
|
|
133
|
+
- Launch tests with `pytest`. Current coverage targets the Conway automaton;
|
|
134
|
+
extending coverage for other modes is encouraged.
|
|
135
|
+
- `flake8` enforces an 80-character line limit; run `flake8 src tests` before
|
|
136
|
+
committing.
|
|
137
|
+
- To add a new automaton, implement it under `src/automata/`, expose it from
|
|
138
|
+
`automata/__init__.py`, and register it in `gui/config.py`.
|
|
139
|
+
- The GUI is intentionally modular: prefer adding features in dedicated helper
|
|
140
|
+
modules rather than growing `gui/app.py`.
|
|
141
|
+
|
|
142
|
+
Further details can be found in:
|
|
143
|
+
|
|
144
|
+
- `docs/USER_GUIDE.md` – end-user walkthrough.
|
|
145
|
+
- `docs/DEVELOPMENT.md` – contributor guidelines and code map.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
This project is distributed under the MIT License. See the `LICENSE` file for
|
|
152
|
+
full terms.
|