// CELLULAR AUTOMATON 2 / Purple Beads Chain '08.06 // by Tsutomu HIGO URL>>> http://www.asahi-net.or.jp/~nj2t-hg/ #version 3.6; global_settings { assumed_gamma 2.2 max_trace_level 4 } light_source {<-100, 100, -80> color <0.2, 0.4, 1>} camera { location <0, 50, -200> angle 28 look_at <0, 40, 0> } #declare R1 = seed(6); #declare Nmax = 24; //96 #declare Cp = array[4*Nmax][3*Nmax][3*Nmax]; #declare Ny = 0; #while (Ny < 3*Nmax) #declare Nx = 0; #while (Nx < 4*Nmax) #declare Nz = 0; #while (Nz < 3*Nmax) #declare Cp[Nx][Ny][Nz] = int(5.9999999*rand(R1)); #switch ( Cp[Nx][Ny][Nz] ) #case (0) #declare Cp[Nx][Ny][Nz] = 0; #break #case (1) #declare Cp[Nx][Ny][Nz] = 0; #break #case (2) #declare Cp[Nx][Ny][Nz] = 0; #break #case (3) #declare Cp[Nx][Ny][Nz] = 2; #break #case (4) #declare Cp[Nx][Ny][Nz] = 1; #break #case (5) #declare Cp[Nx][Ny][Nz] = 2; #break #end #declare Nz = Nz+1; #end #declare Nx = Nx+1; #end #declare Ny = Ny+1; #end blob { threshold 0.3 #declare Ny = 1; #while (Ny < 3*Nmax) #declare Nx = 0; #while (Nx < 4*Nmax) #declare Nz = 0; #while (Nz < 3*Nmax) #declare Cp[Nx][Ny][Nz] = mod(Cp[mod(Nx-1+2*Nmax,2*Nmax)][Ny-1][Nz] +Cp[mod(Nx+1, 2*Nmax)][Ny-1][Nz] +Cp[Nx][Ny-1][mod(Nz-1+2*Nmax,2*Nmax)] +Cp[Nx][Ny-1][mod(Nz+1, 2*Nmax)],6); #switch ( Cp[Nx][Ny][Nz] ) #case (0) #declare Cp[Nx][Ny][Nz] = 0; #break #case (1) #declare Cp[Nx][Ny][Nz] = 0; #break #case (2) #declare Cp[Nx][Ny][Nz] = 0; #break #case (3) #declare Cp[Nx][Ny][Nz] = 2; #break #case (4) #declare Cp[Nx][Ny][Nz] = 1; #break #case (5) #declare Cp[Nx][Ny][Nz] = 2; #break #end #if( Cp[Nx][Ny][Nz] = 1 ) sphere {, 1, 1.5} #end #if( Cp[Nx][Ny][Nz] = 2 ) sphere {, 0.5, 1.5} #end #declare Nz = Nz+1; #end #declare Nx = Nx+1; #end #declare Ny = Ny+1; #end pigment {color rgb <0.9, 0, 1>} finish { reflection 0.8 phong 1 brilliance 1 ambient 0.2 } }