CELLULAR AUTOMATA SIMULATOR ( Version 1.9A MAY 1993) ---------------------------------------------------- INTRODUCTION ------------ This is another example of a reasonably serious application written using the "Simple User Interface Toolkit" (SUIT). It follows on from my petri-net simulator which was released Nov 1992. Please read the DISCLAIMER and SUIT sections below. ABOUT ----- The program will not run very well (if at all) on a monochrome system. it was designed for colour. The program has been compiled and tested on the following architectures: 486SX 25 PC 4MB RAM TVGA8900C video card, running Linux (99-9), Xfree86(1.2) Sun Micro-systems SPARCstation IPC, SunOS 4.1.1, X11R5. FTPing ------ The program sources and Sparc binaries can be obtained by ftp from export.lcs.mit.edu in the directory contrib/suit. This directory also contains other SUIT related work by the author. ** CELLULAR AUTOMATA ** INTERFACE --------- +------------------------------------------------------------- | ********************* TITLE BAR BUTTON ******************* | |ANALYSIS +-------------------------------------------+ |----------------| | | | | STEP | | | CORE | GRID | | | | | | | | CLEAR | | |----------------| FILE | | | | | | | ACTIVE |+-------+| | | || || G R A P H I C S | | || || | |----------------|| RULES || | | || LIST || | | FIRED || || | | || || | | || || | |----------------|+-------++---------------------------------+ | EXIT STOP | rows cols states **COLOUR_BAR** | +------------------------------------------------------------+ The graphics area contains rectangular cells which can have various states. The state is incremented by clicking with the mouse, and decremented by pressing a key when the mouse is over the cell. To operate this program all you have to do is draw something in the graphics area, click on a rule, and see what happens. WHAT THE BITS OF THE DISPLAY DO ------------------------------- ANALYSIS toggles the refreshing of the analysis widgets CORE, ACTIVE and FIRED. The analysis data is still updated, but will only be shown if the widget is on. Disabling the analysis will speed up the program on slower systems. ACTIVE This shows a line-graph of how many cells are active (ie have state which is greater than zero) at each execution of the network. This is reset when a new automata is loaded or when any modifications are made to the graphics area. CLEAR sets the state of the cells in the automata to 0 and redraws the graphics. The redrawing part can appear to be a bit slow when there are a lot of rows and columns. COLS sets the number of columns in the current automata. Will reset the contents of the automata. must be pressed to accept the new number of columns. Currently the number of columns has been arbitrarily limited to 100. CORE This shows a smaller version of the automata and its stable core. i.e the cells that have fired the most frequently. This is reset when a new automata is loaded or when CLEAR is selected. The core widget has a mini-RIBBON inside it. This is used in the core widget to show how many time each cell hash fired. The colour scale is intended to go from darker to lighter colours, This isnt absolutely correctly implemented yet, but will be fixed in later releases *NOTE* the stable core widget, by the use of lots of colour is a bottleneck to the performance to the program. Analysis widgets can be turned off using the ANALYSIS widget. EXIT terminates the program. FILE.. A menu button whose menus allows file loading and saving. Currently PGM (portable grey map) and program specific files are supported. FIRED This shows a line-graph of how many cells have changed state at each execution of the network. This is reset when a new automata is loaded or when any modifications are made to the graphics area. GRID toggles the state of the grid to be on or off. The grid will be drawn to the aspect ratio of the Graphics widget. RIBBON This gadget can not be directly interacted with. It just shows the colours associated with the different states. ROWS sets the number of rows in the current automata. Will reset the contents of the automata. must be pressed to accept the new number of rows. Currently the number of rows has been arbitrarily limited to 100. RULES_LIST A scrollable list of current rules. See below for details of the rules. selecting a rules executes it. A STOP widget will be displayed next to the EXIT button. If the STEP gadget is selected (DOWN) the system will do one execution of the selected rule before returning to an idle state. If the step gadget is de-selected (UP) then the system will continue to execute the selected rule until the system reaches a static state or the user selects the STOP widget. STATES sets the number allowable number of states the user can enter. Has no effect on the execution of the automata. Currently there are a ridiculously high number of states, but in practice only about 10 will actually ever be used. Cells with higher states than the value input will be thresholded to the new maximum STATE. STEP toggles whether the automata single steps or continues execution until the operation has been stopped. STOP This button is only visible when a RULE is being executed. When displayed, all other buttons and text fields are inactive. RULES ----- The notation used relies upon the neighbours of the current cell. +------+--------+------+ | | | | | NW | North | NE | | | | | +------+--------+------+ | | | | | West | Centre | East | | | | | +------+--------+------+ | | | | | SW | South | SE | | | | | +------+--------+------+ The following rules have been implemented in this release of the simulator. -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- ANNEAL The behaviour of this rule is similar to thermodynamic annealing. state | old new | reason --------+---------------------------- 0 1 | 4,6,7,8,9 active neighbours 1 0 | 0,1,2,3,5 active neighbours -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- BRIANS_BRAIN state | old new | reason --------+------------------------------------ 0 1 | exactly 2 neighbours are in state 1 1 2 | always 2 0 | always -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- CODD +---+ | 1 | +---+---+---+ +---+ | 0 | 1 | 1 | -> | 0 | +---+---+---+ +---+ | 0 | +---+ +---+ | 0 | +---+---+---+ +---+ | 1 | 0 | 1 | -> | 1 | +---+---+---+ +---+ | 1 | +---+ +---+ | 1 | +---+---+---+ +---+ | 1 | 0 | 1 | -> | 1 | +---+---+---+ +---+ | 1 | +---+ -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- DIAMONDS new state = North or East or South or West -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 4 WAY FILL state | old new | reason --------+--------------------------------------------- 0 2 | if North, East, South or west are in state 2 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- 8 WAY FILL state | old new | reason --------+---------------------------------------- 0 2 | if any of the neighbours are in state 2 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- GRAVITY state | old new | reason --------------+------------------------ 0 North | always Centre 0 | if south neighbour is 0 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- GROWTH state | old new | reason --------+--------------------------------- 0 1 | if the number of neighbours is 0 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- HGLASS A random-ish rule which uses this lookup table: EWSNC C' |EWSNC C' |EWSNC C' |EWSNC C' | ---------+---------+---------+---------+ 00000 0 |01000 0 |10000 1 |10000 1 | 00001 1 |01001 1 |10001 1 |10001 0 | 00010 1 |01010 0 |10010 1 |10010 0 | 00011 1 |01011 1 |10011 0 |10011 1 | 00100 1 |01100 1 |10100 0 |10100 0 | 00101 0 |01101 0 |10101 0 |10101 1 | 00110 0 |01110 1 |10110 0 |10110 0 | 00111 0 |01111 1 |10111 0 |10111 1 | where C' represents the new state of the cell. -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- LICHENS state | old new | reason --------+---------------------------------------- 0 1 | if the number of neighbours is 3,7 or 8 1 0 | if the number of neighbours is 4 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- LIFE Conways classic game of life. I'm using state 2 to show that the cell has survived. state | old new | reason --------+---------------------------------------- 0 1 | if the (number of neighbours) is 3 1 2 | if the (number of neighbours) is 2 or 3 C 0 | otherwise -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- MAJORITY state | old new | reason --------+------------------------------------------ 0 1 | if the (number of neighbours)+self is > 4 1 0 | if the (number of neighbours)+self is < 5 -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- PARITY new state = North xor East xor South xor West -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- SQUARES new state = North or NE or East or SE or South or SW or West or NW -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- TRIANGLES new state = North or East or West -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- TUBE_WORM state | old new | reason ------------|---------------------------------------------- 0 ALARM | if a neighbour is in alarm state. 0 ALARM | if the number of active neighbours >threshold C C-1 | otherwise -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- TUBE_WORM_2 state | old new | reason ------------|---------------------------------------------- 0 ALARM+n | if n neighbours are in alarm state. 0 ALARM | if the number of active neighbours >threshold C C-1 | otherwise Of the rules above I think that life, brains brain, lichens and anneal are the most interesting. Im sure that there are more rules and If you know of any contact me and Ill put it in. BUGS ---- I expect there are a few lurking bugs in the program. Ive tried to remove as many as possible and have had little problems using the software. But then every author says the same. I've tried as much as possible to use ANSI C, I am unlikely to be able to solve any compilation problems that you may have. If you have a problem compiling SUIT then please get in contact with SUIT support. Similarly I can't guarantee to fix any bug-reports I might get. Although as a budding software engineer (so I've been told) I guess I should make sure my software is as free from bugs as possible. TODO ---- If I had the time I would do the following things: Allow importing/exporting of cells, into the automata. Set/clear/move an area of the automata, Allow user defined automata rules, Give some online help. Provide a playback facility. Provide a "print" facility. FILE FORMAT ----------- The *.auto files are examples of cellular automata files that are used by this application. It uses a weird format that I dreamt up, mainly because I didn't look around for other suitable file formats. The first line in the file must start with the string "Cellular automata file" This is how the program knows that it has the right type of file Cellular automata file The next 3 lines declare the number of rows, columns and states of the automata. 5 rows 9 columns 3 states and finally an array of states in rows x cols format. DISCLAIMER ---------- The software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (LICENSE) ; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. SUIT ---- SUIT -- The Simple User Interface Toolkit SUIT is a library of interface tools developed at the University of Virginia to help C programmers create sophisticated mouse based interfaces without the lengthy learning period associated with traditional user interface toolkits. Ease of learning and fast ramp up time is central to SUIT's design. Also central to SUIT design is portability. SUIT programs currently run without changes to the source code on the following platforms: IBM PC, Macintosh, Sun3, Sun4 (SparcStation), SGI (Silicon Graphics IRIS workstations), DECstation, HP. SUIT is available through anonymous ftp from uvacs.cs.virginia.edu (128.143.8.100). Each SUIT distribution package comes with full source code and documentation. SUIT, including all its source code, is available without charge to Universities and other non-profit institutions. For-profit organizations, and people requiring more information can send email to suit@uvacs.cs.virginia.edu SUIT (c) 1990, 1991 , 1992 Copyright Rector and Visitors of the University of Virginia THANKS ------ Thanks go to the people who created SUIT. Without them I probably wouldn't have bothered writing this SUIT application. Thanks also go to the Joint Network Team at the Rutherford Appleton Laboratory for teaching me C. I must thank Laser Scan Ltd, for giving me 2 excellent placements and giving me a taste of the real world. How can I not mention the people at Robert Fleming Ltd for unknowingly starting me out on the computing trail. THE AUTHOR ---------- My current email address is cs89ssg@uk.ac.brunel. This certainly will not be the case after July 1993. I am likely to have an account on at least a public access unix site so I should be contactable via newsgroups after this date.