Cellular automata

Cellular automata is a small program in Basic generating elementary cellular automata. For more information on the topic, see e.g. Wikipedia.

Cellular automata has been tested and found working correctly under Altair 8K basic, Microsoft Basic-80, GW-BASIC 3.23, and Atari ST Basic.

Downloads

Cellular Automata 1.0 can be downloaded here (1233 bytes).

Code listing

LICENSE

Copyright 2021 Joost Winter (a.k.a. Mad Wizard Software)

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

cellular.bas

10 DIM A(80),B(80)
20 PRINT "CELLULAR AUTOMATA"
30 PRINT "MAD WIZARD SOFTWARE 2021"
40 PRINT
50 PRINT "INSTRUCTIONS (1=Y,0=N)";
60 INPUT W
70 IF W=0 THEN 90
80 PRINT "WE RECOMMEND RULE 30"
90 PRINT "RULE #";
100 INPUT X
110 PRINT "WIDTH (MAX 80)";
120 INPUT Y
130 IF Y>80 OR Y<1 THEN 110
140 Z=INT(Y/2)
150 A(Z)=1
160 FOR J=1 TO Z
170 FOR I=1 TO Y
180 IF A(I-1) THEN 210
190 PRINT " ";
200 GOTO 220
210 PRINT "*";
220 IF I>(Y-2) THEN 270
230 IF X AND 2^(4*A(I-1)+2*A(I)+A(I+1)) THEN 260
240 B(I)=0
250 GOTO 270
260 B(I)=1
270 A(I-1)=B(I-1)
280 NEXT I
290 PRINT
300 NEXT J
310 END