Game of Life#
Why the Game of Life?#
Conway’s Game of Life is a cellular automaton on a 2D grid where each cell is either alive or dead. The next generation of the grid is computed from three deceptively simple rules:
A live cell with 2 or 3 live neighbors survives.
A dead cell with exactly 3 live neighbors becomes alive.
Any other cell dies (or stays dead).
That’s it. Yet these rules are enough to reveal blinking oscillators, spaceships gliding across the grid and self-replicating structures.
For a SAF tutorial the Game of Life has one big advantage: it stays product-agnostic while exercising most of the building blocks that a real engineering solution needs.
SAF concepts you will meet#
By the end of the tutorial you will have written and understood:
The steps that make up your application.
See Solution definition.
A step holds the inputs, outputs, and methods that make up a computation. It is the main building block of a SAF solution.
See Step models.
Data containers that hold the inputs, outputs, and intermediate data of a step. Fields can be typed, validated, and have dependencies on other fields.
Short computations that finish right away. For example, updating a field or very short calculations that return a result immediately.
See Definition.
Longer computations that keep going while the user carries on using the app. Typically, these methods are intended for job executions, long-running simulations, or any process that may take a significant amount of time to complete.
Messages sent from the running computation to the UI so the user sees generations, percentages or logs appear in real time.
See Events.
User-facing Dash pages that let the user interact with the backend and visualize results.
See Dash frontend.
Packaging the finished solution as a single file you can hand to any user, with no Python or setup on their side.
Prerequisites#
Before starting, make sure your workstation meets the requirements listed in the
Prerequisites section and that you can run saf --version in a terminal.
You will also get more out of the tutorial if you are comfortable with:
Basic Python (classes, decorators, type hints).
The idea of a web application with a backend and a frontend.
Reading small snippets of Plotly Dash code.
Everything else — SAF concepts, ansys-saf-cli commands, Dash Mantine components—is introduced
progressively as you need it.
Learning path#
The tutorial is organized in five phases. Follow them in order — each phase builds on the previous one.
Create the solution from the SAF template, install it, and run the empty application.
Add the pure Python engine that computes Game of Life generations.
Wire the business logic into a SAF step model with typed fields, transactions and events.
Build the Dash page that drives the backend and animates the grid in real time.
Ship the finished solution as a standalone desktop installer, for Windows or Linux.
Tip
Every phase ends with a Key takeaways panel that recaps the SAF concepts you just met. Those panels double as a cheat sheet when you start writing your own solution.