Cellular automata, WinCA Application II
This is the second article in the series about the WinCA application, dedicated to the construction and execution of cellular automata. In this article I will show how to design the different states that can have the automaton cells, and the properties that can be assigned to them, using the application editors.
Here you can find the first article of the series about WinCA application.
In this link you can download the WinCA application executables, and in this other one you can download the source code of the WinCA solution, written in CSharp with Visual Studio 2015.
Properties are the values associated with the states. The color of the state, for example, is a property. They can be values of type int, double, string, bool or Color. Another example of property, in the automaton that implements Conway's game of life, is the one that indicates whether the cell is alive or death, and is of Boolean type. All states should have the same properties, although their values can be different.
To show the property editor, you can open the Life Game automaton, the Life-game.cauto file in the Examples folder, and click the last button on the first toolbar. Some different editors will open. In the Window menu you can select the one corresponding to the properties, which looks like that:
There are properties with constant and variable value. In this version of the application only the constants are used. The difference is that constants cannot change value at runtime, whereas variables will be used to implement automata with values that can change during execution, creating scenarios of greater complexity.
To create a property, you must first select the data type in the dropdown of the corresponding toolbar. At runtime, the program can perform the convenient conversion of the data type, since these properties are used in the expressions that determine the changes of state of the cell.
Once the data type is selected, the property can be created with the button on the left of the drop-down list. To delete the properties selected in the list below, you have to use the button on the right.
The property will appear in the list with a default name. When you select it, the values associated with the property will appear at the bottom, the data type, which you can change, the default value of the property, which will depend on the data type selected, and the name assigned to the property.
You can save the properties to a separate file using the Save and Save As options in the File menu. This can be useful if you want to use the same set of properties for several different automata.
In the File menu, you can also create a set of properties from scratch with the option New / Property Set, or open a property set with the Open option, selecting the corresponding file type.
Once the properties are defined, you can proceed to define the states. If you have opened an automaton file, you can also select the status editor from the Window menu. It looks like this:
In the toolbar at the top, you can select in the drop-down list the set of properties associated with the states from among all that you have open. With the next button to the right of the drop-down list, you can open or show the corresponding property editor.
The next button is used to open the editor of transitions between states, which I will explain in the next article, and the last button allows display the automata editor.
To the right of the window is the list of states. You can create a new state using the first button on the toolbar that is above the list of states, and delete the selected states with the second button.
Below the list we can see the state name and color editor. The color drop-down list will display all the properties of the selected set that are of color type, and it is mandatory for all states to have an associated color. State names must be unique.
In the middle part you will find the list with all available properties. To associate properties with a state, you must select them in this list and use the > arrow button in the toolbar above this list.
Finally, on the right is the editor for the properties of the current state selected in the list of states. When you select any of these properties, you can change the associated value for this state in the editor below the list. You can also remove a property from the state by selecting it and using the arrow button < that is in the toolbar corresponding to this list.
As with properties, you can save the states, along with their properties, to a separate file using the Save and Save As options in the File menu, or create a new set of states with the New / State Set option.
In the next article, I will show the definition of the language to define transitions between cell states.