'This version of the 'plant' seems to behave fairly well. The leaves and flowers now only attach to one other
'part of the plant and there is less likelyhood that a cell is born that is not attached to the plant. The stems
' still occassionally attach themselves to each other but at present I am not too worried about this
' characteristic.
'Plant ver_1.1
'(Multi-veggie-bot)
'
'The bot has three cell types - a stem, a leaf and a flower.
'
'A stem is the only part of the bot that can reproduce.
'It can by tied to a maximum of 3 other cells.
'
'The flowers and leaves will only attach themselves
'to one other part of the plant and if a cell is not
'attached to any part of the plant it will try and
'reattach itself.
'Declare plant specific variables
'Allocate Address 50 as the identifier for cell type
def type 50
'Allocate Address 51 as a count for the number of times a stem cell has turned
def turn 51
'Allocate Address 52 as a counter for use during tie creation
def tiecounter 52
'End of Declarations
'Gene 1 - Allocate cell type at birth
'
'NB - Value of type can be:-
'
'1 - Stem
'2 - Leaf
'3 - Flower
cond
*.type 1 <
start
2 rnd 1 add .type store
stop
'End of Gene 1
'Gene 2 - I am a leaf
'
'If I am a leaf and have more than 1 tie
'then delete 1 of them
cond
*.type 2 =
*.numties 1 >
start
1 .deltie store
stop
'End of Gene 2
'Gene 3 - I am a flower
'
'If I am a flower and have more than 1 tie
'then delete 1 of them
cond
*.type 3 =
*.numties 1 >
start
1 .deltie store
stop
'End of Gene 3
'Gene 4 - I am a stem part 1
'
'I am a stem.
'I can still turn
'I am attached to less than 3 other cells
'I can't see anything
'I am currently not establishing a tie with another cell
'
'As a result I will reproduce and start the tie counter
cond
*.type 1 =
*.turn 8 <
*.numties 3 <
*.eye5 40 <
*.tiecounter 1 <
start
20 .repro store
.tiecounter inc
stop
'End of Gene 4
'Gene 5 - I am a stem part 2
'
'I am a stem.
'I can still turn
'I am attached to less than 3 other cells
'I can see something
'I am currently not establishing a tie with another cell
'
'As a result I will just turn
'Add 1 to my turn counter
cond
*.type 1 =
*.turn 8 <
*.numties 3 <
*.eye5 40 >
*.tiecounter 1 <
start
314 .aimsx store
.turn inc
stop
'End of Gene 5
'Gene 6
'
'I am in the process of establishing a tie with another cell
'
'Increase my tie counter
cond
*.tiecounter 0 >
start
1 .tie store
.tiecounter inc
stop
'End of Gene 6
'Gene 7
'
'I have finshed establishing a tie with another cell
'
'Reset my tie counter so that I may reproduce again
cond
*.tiecounter 10 >
start
0 .tiecounter store
stop
'End of Gene 7
'Gene 8 - I am not part of the plant
'
'If I am not tied to the plant
'then form a tie with the cell in front of me
'as I should be facing my parent stem cell
cond
*.numties 0 =
start
1 .tie store
stop
'End of Gene 8
end