default cell=cell; default direc=direc; // rules for transportation rot if (cell && direc=='>') { // when the replicating cell has finished replicating start cutting the cells connection if (nw:direc=='>,3' && ne:direc=='>,1' && ne:cell=='o' && ea:cell=='L' ) { cell='*'; direc='.'; } // when the replicating cell has finished replicating start cutting the cells connection else if (sw:direc=='>,1' && se:direc=='>,3' && se:cell=='o' && ea:cell=='R' ) { cell='*'; direc='.'; } // rules to cut the new cell else if (we:cell=='*') { // close the loop and create the final arm extender if (cell=='E') { cell='F'; if(no:direc) direc='>,1'; else direc='>,3'; } // start the arm creating process and cutting process else if(no:cell=='o' || so:cell=='o') cell='E'; } //rules to cut the old cell else if (ea:cell=='*') { // close the loop and create the final arm extender if (cell=='E') cell='F'; // start the arm creating process and cutting process else if(we:cell=='o') cell='E'; } // This is the rule to turn the direction of the weakly growth element '>' when turning a corner else if (we:cell=='>,1' || we:cell=='>,3') cell='>'; // This turns a new arm element into a temporarily inactive signal when around the left U turns else if(we:cell=='E' && we:direc=='>,1' && sw:cell=='*' && no:direc=='>,3') cell='C'; // This turns a new arm element into a temporarily inactive signal when around the left U turns else if(we:cell=='F' && we:direc=='>,1' && cell=='C' && no:direc=='>,3') cell='C'; // This turns the inactive signal back to a growth after encountering the left U turns else if(we:cell=='C' && nw:cell=='C' && ea:direc=='.' && no:direc=='>,3') cell='E'; // This turns the inactive signal back to a growth after encountering the left U turns else if(we:cell=='C' && cell== 'E' && ea:direc=='.' && no:direc=='>,3') cell='F'; // This turns a new arm element into a temporarily inactive signal when around the right U turns else if(we:cell=='E' && we:direc=='>,3' && nw:cell=='*' && so:direc=='>,1') cell='C'; // This turns a new arm element into a temporarily inactive signal when around the right U turns else if(we:cell=='F' && we:direc=='>,3' && cell=='C' && so:direc=='>,1') cell='C'; // This turns the inactive signal back to a growth after encountering the right U turns else if(we:cell=='C' && sw:cell=='C' && ea:direc=='.' && so:direc=='>,1') cell='E'; // This turns the inactive signal back to a growth after encountering the right U turns else if(we:cell=='C' && cell== 'E' && ea:direc=='.' && so:direc=='>,1') cell='F'; // This prevents the new Growth 'E' from coping itself into the loop structure permenantly left else if (we:cell=='E' && (nw:cell=='F' || nw:cell=='C') && sw:direc=='.' && ea:cell) cell='o'; // This prevents the new Growth 'E' from coping itself into the loop structure permenantly right else if (we:cell=='E' && (sw:cell=='F' || sw:cell=='C') && nw:direc=='.' && ea:cell) cell='o'; // This prevents the new Growth 'F' from coping itself into the loop structure permenantly left else if(cell!='E' && we:cell=='F' && so:cell=='.' && ea:cell) cell='o'; // This prevents the new Growth 'F' from coping itself into the loop structure permenantly right else if(cell!='E' && we:cell=='F' && no:cell=='.' && ea:cell) cell='o'; // This makes the descion growth bit inactive after it makes the first corner left else if (we:cell=='D' && we:direc=='>,1' && no:direc=='.' && nw:direc == '>,1' && sw:cell=='.') cell='C'; // This makes the descion growth bit inactive after it makes the first corner right else if(we:cell=='D' && we:direc=='>,3' && so:direc=='.' && sw:direc =='>,3' && nw:cell=='.') cell='C'; // This changes the inactive signal to a U turn signal else if(we:cell=='C' && we:direc=='>,1' && no:direc=='.') cell='U'; // This changes the inactive signal to a U turn signal else if(we:cell=='C' && we:direc=='>,3' && so:direc=='.') cell='U'; // This changes the growth signal to the U turn signal else if(we:cell=='D' && we:direc=='>,3' && ea:cell=='.' && no:cell !='.') { if(so:direc=='.') cell='U'; else cell='C'; } // This changes the growth signal to the U turn signal else if(we:cell=='D' && we:direc=='>,1' && ea:cell=='.' && so:cell !='.') { if(no:direc=='.') cell='U'; else cell='C'; } // Just copy the next cell else cell=we:cell; } // rules to create additional path if (cell=='.') { // Makes the structure do a left handed U turn rot if(no:cell=='U' && ne:cell=='>,3' && ne:direc=='>,3' && no:direc=='>,2' && nw:direc=='.') { cell='o'; direc='>,1'; } // Makes the structure do a right handed U turn rot if(so:cell=='U' && se:cell=='>,1' && se:direc=='>,1' && ea:direc=='>,1' && sw:direc=='.') { cell='o'; direc='>,3'; } // Prevents the signal from being extended beyond the size of the square else rot if(se:direc=='>,2' && so:direc=='>,3' && so:cell=='>,3') cell='.'; // Prevents the signal from being extended beyond the size of the square else rot if(sw:direc=='>' && so:direc=='>,3' && so:cell=='>,3') cell='.'; // Makes the structure grow when there is a > or a D structure else rot if ((we:cell=='>' || we:cell =='D') && we:direc == '>' && nw:direc!='>,3' && sw:direc!='>,1') { if(ea:direc=='.') { cell='o'; direc='>'; } else if(ea:direc && (no:direc || so:direc)) { cell='o'; direc='>'; } } // Controls the square shape of the structure by starting the U turn else rot if (so:direc=='>' && ea:cell=='L' && ea:direc=='>,1' && we:cell=='.') { direc='>,2'; cell='o'; } // Controls the square shape of the structure by starting the U turn else rot if (so:direc=='>,2' && we:cell=='R' && we:direc=='>,1' && ea:cell=='.') { direc='>'; cell='o'; } // Controls the first left turn in the loop else rot if (so:direc=='>' && so:cell=='L' && se:direc=='.') { direc='>,3'; cell='o'; } // Controls the first right turn in the loop else rot if (no:direc=='>' && no:cell=='R' && ne:direc=='.') { direc='>,1'; cell='o'; } // Spin off a tail to being another replication structure else rot if (we:direc=='>' && nw:cell!='E' && we:cell=='E' && ea:direc=='.') { cell='>'; direc='>'; } } // rule to cut two loops rot if (cell=='*' && ea:cell=='E' && we:cell=='E') { cell='.'; }