This module offers GUI tools for manipulating table-like step functions of “elementary” cellular automatons.
Ideas for further utilities:
Display conflicting rules for horizontal or vertical symmetry, rotational symmetry, ...
An editing mode, that handles simple binary logic, like:c == 1 then result = 1 c == 0 then result = 0 l == 0 and r == 1 then result = 0
A graphical editing mode that allows adding “pattern matching” for rules with “dontcare fields” or something of that sort.
A graphical editing mode with zooming UI.
The value passed to create_subwidget when a position is not held by a field.
What colors to use for what field values.
A little Widget that displays a cell in a neighbourhood.
Create the DisplayWidget.
A clickable and keyboard-operatable display widget for cells.
Create the editable display widget.
This signal will be emitted when the user changed the value of the cell. It will emit the position and the new value.
Redraw the button, add a rectangle inside the button if it has the focus.
The BaseNeighbourhoodDisplay offers a skeleton for different ways of displaying neighbourhoods.
Subclass this and implement create_subwidget, which will be fed an offset and the corresponding entry from the values dictionary, or GAP if there is no spot in the neighbourhood at that position, and will then be put into a QGridLayout.
This class itself displays colored blocks in the shape of the neighbourhood.
Determine how many fields to allocate in the grid. Subclass this, if you want more gaps around the edges.
Return a tuple of width, height and a tuple of x-offset and y-offset.
Create a widget for a cell in the neighbourhood.
a QWidget initialised for the cell. Alternatively, None.
Manipulate the given widget for the new value.
|Returns:||None, if the widget was manipulated, alternatively a new QWidget to take its place.|
A simple utility class to display a neighbourhood widget and a result widget next to each other in different relations.
Create the widget.
A window usable to modify the table of an elementary step function.
Recalculate what number corresponds to the result values saved in digits_and_values. :returns: the new rule number.
React to a size change of the widget.