new-experiment   10 is #layers  \ imposto il numero di layers necessari

256 constant D

D by D space                    \ imposto le dimensioni dello spazio

\ ************ define the rule tables ********************

0 0 == center
1 1 == center'
0 1 == centers

2 2 == north
3 3 == south
4 4 == east
5 5 == west

6 6 == n.east
7 7 == n.west
8 8 == s.east
9 9 == s.west

create-lut thin1-table
create-lut thin2-table
create-lut thin3-table
create-lut thin4-table
create-lut thin5-table
create-lut thin6-table
create-lut thin7-table
create-lut thin8-table
create-lut auxiliary-table

: propagate

   update

   center

   dup -> north
   dup -> south
   dup -> east
   dup -> west
   dup -> n.east
   dup -> n.west
   dup -> s.east
       -> s.west
;
  
\ regole

: thin1 center' east south and and 
        north not n.west not west not and and 
        and
        {{ center 0 }} -> center
        center -> center'
        propagate
;

: thin2 center' south s.west and and 
        north not n.east not n.west not and and 
        and
        {{ center 0 }} -> center
        center -> center'
        propagate
;

: thin3 center' west south and and 
        east not north not n.east not and and 
        and
        {{ center 0 }} -> center
        center -> center'
        propagate
;

: thin4 center' west n.west and and 
        east not n.east not s.east not and and 
        and
        {{ center 0 }} -> center
        center -> center'
        propagate
;

: thin5 center' west north and and 
        east not south not s.east not and and 
        and
        {{ center 0 }} -> center
        center -> center'
        propagate
;

: thin6 center' north n.east and and 
        south not s.east not s.west not and and 
        and
        {{ center 0 }} -> center
        center -> center'
        propagate
;

: thin7 center' north east and and 
        west not south not s.west not and and 
        and
        {{ center 0 }} -> center
        center -> center'
        propagate
;

: thin8 center' east s.east and and 
        west not n.west not s.west not and and 
        and
        {{ center 0 }} -> center
        center -> center'
        propagate
;

\ creazione delle tabelle

?rule>table thin1 thin1-table
?rule>table thin2 thin2-table
?rule>table thin3 thin3-table
?rule>table thin4 thin4-table
?rule>table thin5 thin5-table
?rule>table thin6 thin6-table
?rule>table thin7 thin7-table
?rule>table thin8 thin8-table
 





\ ******************* define the steps *********************

define-step  free-step

	full-space
        lut-src         site
        site-src        lut       \l'update avviene
                                  \tramite look up table

        display         0 fix     \ visualizzo i siti

	kick		north  field   0 x   1 y
			south  field   0 x  -1 y
			east   field  -1 x   0 y
			west   field   1 x   0 y
			n.east field  -1 x   1 y
			n.west field   1 x   1 y
			s.east field  -1 x  -1 y
			s.west field   1 x  -1 y

	run 		free

end-step




\ ******************* run the experiment ********************

: th

        lut-data      thin1-table \ carico la prima tabella
        switch-luts               \ cambio la look up table attiva
        lut-data      auxiliary-table
        step                      \ mando i comandi in esecuzione
        full-space    step
        free-step                 \ eseguo l'update
 
        lut-data      thin2-table
        switch-luts
        lut-data      auxiliary-table
        step
        full-space step
        free-step

        lut-data      thin3-table
        switch-luts
        lut-data        auxiliary-table
        step
        full-space step
        free-step

        lut-data        thin4-table
        switch-luts
        lut-data        auxiliary-table
        step
        full-space step
        free-step

        lut-data        thin5-table
        switch-luts
        lut-data        auxiliary-table
        step
        full-space step
        free-step

        lut-data        thin6-table
        switch-luts
        lut-data        auxiliary-table
        step
        full-space step
        free-step

        lut-data        thin7-table
        switch-luts
        lut-data        auxiliary-table
        step
        full-space step
        free-step

        lut-data        thin8-table
        switch-luts
        lut-data        auxiliary-table
        step
        full-space step
        free-step

;

"" cam1.pat file>cam              \ carico l'immagine
                                  \ da elaborare

begin th key? until               \ eseguo finche' non
                                  \ viene premuto un tasto


Ritorno