Applet: The Hodge-Podge Machine - Fun With Self Organizing Cellular Automata
Filed under: Java, automata, hodge-podge | No Comments »
Filed under: Java, automata, hodge-podge | No Comments »
As part of the hodge-podge specification [link] a widget for changing the infectivity was specified. The initial spec was for a slider, however, a more appropriate choice would be to allow int values to be entered by the user as well as to increase/decrease values in steps. The Java JSpinner widget using the SpinnerNumberModel is [...]
Filed under: Java, automata, code, hodge-podge, solutions | No Comments »
HodgePodgePixel extends FlyweightCell by implementing the abstract
update(int x, int y, Neighbourhood neighbourhood, CellCollection cells);
method with the hodge-podge algorithm:
/**
* Selectively apply 1 of 3 rules to calculate the next generation depending on current state:
* ‘ill’ ie state = n
* ‘healthy’ [...]
Filed under: Java, automata, code | No Comments »
Here is the colouriser for the hodge-podge machine. It extends HTMLColour16 by taking 2 colours and creating a table full of RGB colour values that range between them. The number of colours created matches the number of hodge-podge states but can be biased towards one or other of the original 2 starter colours.
The default constructor [...]
Filed under: Java, automata, code | No Comments »
OOP encapsulation is about more than just hiding data…
Actually trying to use the automata package to write a hodge-podge machine highlighted that the Neighbourhood class still left the testing to the user. The class should hide the boundary testing and simply return valid neighbour locations as a list of points. The application can then [...]
Filed under: Java, automata, code | No Comments »
The CellCollection is the data model it has the toPixels method…
/**
* Converts the cells to a linear array of pixels, through
* the colour convertor, ready for display
* @param Colouriser colours - the chosen false colouring process
* @return int[] - argb 24 bit colour format
*/
public int[] toPixels(Colouriser colours);
…that returns a coloured pixel array view of the [...]
Filed under: Java, automata, code | No Comments »
A key part of cellular automata functioning is the neighbourhood of cells each takes into account when calculating its state at t+1. There a many such sizes and shapes of neighbourhoods and the automata package needs to allow for that with extensibilty whilst providing a few basic types such as Von Neuman [link] and Moore [...]
Filed under: Java, automata, code | No Comments »
I have recently had a little time to play around with some classes for cellular automata as per my spec [link].
Filed under: Java, automata, code | No Comments »