[ Welcome to NKS - SJSU ]

 Squaring Rule Applet Page

By Haile Eyob

Home | Links | Applets | Papers | Class Plan | Team

 

1D-Squaring Rule

 

 

 


Source Code

Description of the Java Applet

The java applet is based on the squaring rule which is explained in Wolfram book "A new Kind of Science." The 1D CA generates the square of integer numbers. Each cell in it used only the 3 squares directly above it to determine its color. There are 5 possible color for each cell. The applet starts with n black, followed by 1 blue and then 1  yellow colors (or squares). After certain steps the CA produces a block of n * n red cells, which is the square of n (the number of black cells initially).

The applet works only for integers. The range allowed is [-19, 19]. 

Operation of the applet

The applet starts with the number given in the textfield (which is 10). In the end the applet will compute the square of 10 = 100 red cells.

Controls buttons:

Start  -- initializes the first row with the given number of black cells, 1 blue cell and 1 yellow cell. The applet begins processing the next row of cells using the squaring. You can also press "Enter" after inputting a number in the box.

Pause  -- stops the applet.

Resume -- continues processing from where the applet had paused..

Random - initializes the first row of the canvas randomly with the given colors. The applet follows the same rules.

Clear  -- Clears the canvas of the image.


The Transition Rules

The following are the rules used in the squaring rule applet:

Correspondence between colors and numbers:
white => 0     black => 1     yellow => 3     blue => 4     red => 5

where "_" represents 0, 1, 3, 4 or 5.

{0,0,1}->4    {0,4,1}->5    {4,1,3}->0    {3,3,4}->0    {5,3,3}->5    {0,0,3}->5    {0,5,5}->5    {5,3,4}->5    {3,5,4}->3    {3,1,3}->0    {3,5,0}->5    {0,4,3}->0    {_,3,1}->5    {_,5,1}->3    {_,5,3}->3    {_,3,5}->5    {3,0,0}->4    {1,3,4}->5    {5,4,0}->3    {5,4,_}->5    {_,5,4}->4    {4,3,_}->4    {_,4,3}->3    {_,1,5}->4    {_,1,_}->1    {_,5,_}->5    {0,_,_}->0    {_,4,_}->4    {_,_,_}->0}
where "_" represents 0, 1, 3, 4 or 5.

For example:

{0,0,1}->4   means       white + white + black => blue 

{_,1,_}->1   means       any color + black + any color => black

 

 

 

 

All NKS-SJSU Applets are Open Source Shareware, Papers are Copyrighted to their Authors.