Lightweight educational simulation library for AI-generated visual lessons
Project description
ember
ember is a small educational simulation library.
The main goal is simple: an AI or teacher should be able to make a clear visual simulation without writing hundreds of lines. The code should focus on the idea, not on drawing everything manually.
It is useful for:
- explaining science and maths concepts
- making small interactive lessons
- generating GIF/PNG style visual explanations
- testing how LLMs can create better teaching simulations
This is not a game engine in the big sense and it is not a console emulator. It is a lightweight sandbox for educational visuals.
What Is Inside
- A C11 core library in
src/andinclude/ - Python bindings in
python/ember/ - A high-level education API in
python/ember/edu.py - Example simulations in
examples/andgames/ - Plain text mission files in
missions/ - Documentation in
docs/
The most important API for AI-generated lessons is ember.edu.
Example Gallery
These previews are regenerated into docs/gallery/ so changes in the visual
library are visible in the README. The small examples show the target style:
AI writes one clear mechanism in roughly 40-50 lines instead of making a large
custom app.
Regenerate the gallery after visual/library changes:
make gallery
| Concept | Source | Render |
|---|---|---|
| Fajan's rule | examples/fajan_sim_test.py - 47 lines | |
| Faraday's law | examples/faraday_sim_test.py - 62 lines | |
| Hybridisation | examples/hybridisation_sim.py - 64 lines | |
| Heart function | games/heart_sim.py - richer demo | |
| Transformer attention | games/transformer_sim.py - richer demo |
Run Examples
From the repo root:
PYTHONPATH=python python3 examples/hybridisation_sim.py
PYTHONPATH=python python3 games/heart_sim.py
PYTHONPATH=python python3 games/transformer_sim.py
Many examples also add the local python/ path themselves, so they can be run
directly with python3.
Build And Test
make all
make test
make python-test
Run the default C mission:
make run
This writes frames into build/.
For AI Agents
Before generating a simulation, read the prompt contract:
import ember
print(ember.prompt)
The same guide is available here:
Important rules for AI-generated simulations:
- Ask what exact mechanism the user wants to understand.
- Websearch for factual topics unless the user provides source material.
- Show one clear cause and effect.
- Prefer concrete scenes over abstract variable animation.
- Keep the code small.
- Use only existing public APIs.
- Do not edit the library unless the user asks for library work.
For most visual lessons, use Lesson plus Sketch:
from ember.edu import Lesson, Sketch
def draw(canvas, state):
canvas.text("main idea", 0, -0.8)
lesson = Lesson("My Lesson", theme="neon")
lesson.show_hud = False
lesson.state.params["_time"] = 0.0
lesson.rate("_time", lambda s: 1.0)
lesson.show(Sketch(draw, "one-line visual legend"))
lesson.explain("One sentence takeaway.")
lesson.run()
Useful Docs
- docs/AI_SIMULATION_GUIDE.md: system prompt for AI agents
- docs/EDU_LIBRARY.md: high-level education API
- docs/GRAPHICS_API.md: lower-level graphics helpers
- docs/PYTHON_BINDINGS.md: Python API
- docs/MISSION_FORMAT.md: text mission format
- docs/CAR_PHYSICS.md: car physics lesson
Project Layout
include/ C public headers
src/ C implementation
python/ember/ Python package
examples/ small concept examples
games/ richer interactive lessons
missions/ text mission files
docs/ documentation
tests/ C and Python tests
Notes
The project is still evolving. The important direction is to make the library more general and easier for smaller models also. If a generated sim needs too much drawing code, that is a sign the library needs a better primitive.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ember_edu-0.2.0.tar.gz.
File metadata
- Download URL: ember_edu-0.2.0.tar.gz
- Upload date:
- Size: 58.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1e69bfcdc6eafce4b458913b97790a5708217f6236c9bcdd9ceb0c5707dd4aa
|
|
| MD5 |
e087683a550dc0aab1582d21159b8533
|
|
| BLAKE2b-256 |
a7f4973a720df295e0a5c0cbcf7fcca850af327dabbec946cfbd1f53ecef7747
|
File details
Details for the file ember_edu-0.2.0-py3-none-any.whl.
File metadata
- Download URL: ember_edu-0.2.0-py3-none-any.whl
- Upload date:
- Size: 55.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf1acaf05fc38a32819dfe0d18f57c196a5493505f08a1462c35ef9e5344bd2b
|
|
| MD5 |
d47de65faa0180318f1ab901a7321cc6
|
|
| BLAKE2b-256 |
e1fa8766a2e4373f0117a7924d68701607e800e72f1860906250447e1ff34a1e
|