Evolution in a no error Language

Evolution in a no error Language preview image

1 collaborator

Default-person Jakob Virgil (Author)

Tags

evolutive algorithm 

Tagged by Jakob Virgil about 9 years ago

no error language 

Tagged by Jakob Virgil about 9 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.2.1 • Viewed 273 times • Downloaded 23 times • Run 0 times
Download the 'Evolution in a no error Language' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Info?

I'd be interested in reading some info about this model.

Posted about 9 years ago

Click to Run Model

turtles-own [brain cur belly]
globals [oh one two three four five six seven ]
patches-own [food]

to setup
  ca
 ask patches
   [
     sprout 1
     [
     set brain []
     repeat 64 [set brain lput random 8 brain]
     set shape "circle"
     set heading random 4 * 90
     ; show brain
     ]
   set food 1
   ]
 reset-ticks
end 

to go
 ask turtles
   [
     ifelse belly > .3 [set size belly][set size .3]
     if size > 2 [set size 2]
   set cur cur mod 64
   ifelse item cur brain = 0 [sit][
   ifelse item cur brain = 1 [eat][
   ifelse item cur brain = 2 [steal][
   ifelse item cur brain = 3 [birth][
   ifelse item cur brain = 4 [hunger][
   ifelse item cur brain = 5 [smell][
   ifelse item cur brain = 6 [move][
   ifelse item cur brain = 7 [turn][
   ]]]]]]]]
     set belly belly - metabolism
   if belly < 0
      [
       die
      ]
   ]
   ask patches [set pcolor food set food food + abundance]
   diffuse food .1
  tick
  set oh 0
  set one 0
  set two 0
  set three 0
  set four 0
  set five 0
  set six 0
  set seven 0
end 
;0

to sit
  set oh oh + 1
  set cur cur + 1
  set color white
end 

;1

to eat
  set one one + 1
  set cur cur + 1
  ifelse food > 1 [set belly belly + 1 set food food - 1][set belly belly + food set food 0]
  set color blue
  set belly belly - metabolism
end 

;2

to steal
  set two two + 1
  set cur cur + 1
  ask (turtles-on neighbors) with [belly > 1][set belly belly - 1 ask myself [set belly belly + 1]]
  set color red
  set belly belly - metabolism
end 

;3

to birth
  set three three + 1
  set cur cur + 1
  if count turtles-on neighbors < 8
   [
   let targ one-of turtles-on neighbors
   if targ != nobody
     [
     set belly belly / 2
     hatch 1 [
              set brain mate myself targ
              set cur 0
              move-to one-of neighbors with [ count turtles-here = 0]
             ]
     ]
   ]
   set color green
   set belly belly - metabolism
end 

;4

to hunger
  set four four + 1
  set color violet
  ifelse belly > item ((cur + 1) mod 64) brain [set cur cur + 4][set cur (item ((cur + 2) mod 64) brain) *  (item ((cur + 3) mod 64) brain)]
end 

;5

to smell
   set five five + 1
  set color yellow
  ifelse sum [food] of neighbors  > 1 / ( 1 + item ((cur + 1) mod 64) brain) [set cur cur + 4][set cur (item ((cur + 2) mod 64) brain) *  (item ((cur + 3) mod 64) brain)]
end 

;6

to move
  set cur cur + 1
   set six six + 1
   set belly belly - metabolism
  set color orange
   fd 1
   ask other turtles-here [die]
end 

;7

to turn
  set seven seven + 1
  set color magenta
  set heading 90 * item (( cur + 1 ) mod 64 ) brain mod 4
  set cur cur + 2
end 

to-report mate [ta tb]
   let a [brain] of ta
   let b [brain] of tb
   let o []
   let c 0

   repeat 64
     [
       ifelse random-float 1 < mu [set o lput random 8 o ][ifelse random 2 = 0 [ set o lput (item c a) o ][ set o lput (item c b) o ]]
       set c c + 1
     ]
     report o
end 

to geno-plot
  if show-genome
  [
  let x 0
  let y 0
   clear-plot
  ask turtles [
              set y 0
              foreach brain
               [
                 set-plot-pen-color gene-color ?
               plotxy x y
               set y y + 1
               ]
               set x x + 1
               set-plot-pen-color 0
              ]
  ]
end 

to-report gene-color [in]
  if in = 0 [report gray]
  if in = 1 [report blue ]
  if in = 2 [report red]
  if in = 3 [report green]
  if in = 4 [report violet]
  if in = 5 [report yellow]
  if in = 6 [report orange]
  if in = 7 [report magenta]
end 

There is only one version of this model, created about 9 years ago by Jakob Virgil.

Attached files

File Type Description Last updated
Evolution in a no error Language.png preview Preview for 'Evolution in a no error Language' about 9 years ago, by Jakob Virgil Download

This model does not have any ancestors.

This model does not have any descendants.