home *** CD-ROM | disk | FTP | other *** search
- AUTOMATON*
-
- Brown'n_Motion
-
- 'Brownian Motion' makes use of the Margolus neighbourhood RNDB function.
- This returns a random value for each 2x2 block of cells in the CA universe.
- In this automaton the number is used to select a way of jumbling up the
- cells in each block; thus the total number of cells of each state is
- preserved, & each cell appears to take a random walk in the grid. It starts
- from four ordered, differently coloured circles on a black background.
- Notice how the various colours diffuse into each other, eventually becoming
- uniformly distributed. Compare with 'GeneticDrift'.
-
- INITIALISATION*
-
- 10DEF PROCdo
- 20*SetEval wrap on
- 30*SetEval neig margolus
- 40*SetEval rndb -1
- 50ENDPROC
-
- SCREEN*
-
- 10DEF PROCdo
- 20DIM buf% 256:SYS "OS_ReadVarVal","sux",buf%,256
- 30a%=!buf%:r%=.8*a%
- 40GCOL 63:CIRCLE FILL a%,a%,r%
- 50GCOL 48:CIRCLE FILL -a%,a%,r%
- 60GCOL 12:CIRCLE FILL a%,-a%,r%
- 70GCOL 3:CIRCLE FILL -a%,-a%,r%
- 80ENDPROC
-
- CODE*
-
- ( READ_NEIG
- 2RNDB IF (CW ==) CCW == )
-
- END*