Sunflower Biomorphs

Sunflower Biomorphs preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)



Tagged by Reuven M. Lerner almost 10 years ago


Tagged by Reuven M. Lerner almost 10 years ago


Tagged by Reuven M. Lerner almost 10 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 416 times • Downloaded 37 times • Run 0 times
Download the 'Sunflower Biomorphs' modelDownload this modelEmbed this model

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


A model of evolution where the user provides the selective pressure. The user picks one or two flowers from a grid of randomly generated animated flowers. The selected flowers become the "parents" of the next generation. Over time, the user's selections cause the characteristics of the population to change.


Each flower has four genes that determine its form. For example, one flower may have bigger petals or be more colorful than another. When the user selects the parent or parents of the next generation, and the screen is then cleared and the flowers repopulated with genes based on the genes of their parent(s). The user can exert selection pressure towards colorful flowers, for example, by choosing the most colorful flower(s) available.

At the center of every "flower" is an invisible "spawner". It remains in the center continuously hatching "petals" that move outward. Each spawner holds the four variables: num-colors, step-size, size-modifier, and turn-increment. (Since each petal needs to know how far forward to move each time and how large to grow, they have their own step-size and size-modifier that is identical to the spawner's value that spawned them.) Each turn, each spawner hatches a new petal and turns and sets its color appropriately (based on the values for num-colors and turn-increment.) Once the spawners have all hatched a new petal, each petal simply moves forward its step-size and adjusts its size based on the distance its traveled and its size-modifier. If a petal moves outside the box for that flower, it dies.

The user may choose between asexual (one parent) and sexual (two parents) reproduction. The next generation is created by mutating the values of the parent(s) for the four variables. The existing petals are then killed off, and the next generation is created.


Before clicking SETUP, set the ROWS and COLUMNS to the desired values. These determine how many flowers are present in the model.

Then set the mutation rate appropriately. The higher the mutation rate, the less flowers in the next generation will resemble their parents. If CONTROLLED-MUTATION? is on, then the model controls the mutation by varying it within the population; in this mode, mutation varies among the individuals in the population; where the amount of MUTATION increases in each individual that is to the right of the previous one (or in the next row). Thus, flowers near the top-left of the model will tend to more closely resemble their parents than flowers in the bottom right.

If asexual selection is selected (the ASEXUAL? switch is on), then every click will repopulate the flowers based on the values of the spawner nearest your click. If sexual selection is selected, then the first click selects the first parent (and colors its background grey.) When you click again, the two clicked spawners "mate" and populate the next generation.


Try and get certain flowers patterns to emerge; for example, try to selectively breed towards a very tight spiral, a non-rotating "starfish", or a straight line.

Remember a particularly pleasing flower, then clear all of the flowers, and see if you can evolve your favorite flower again.


It might be neat to allow the user to change the number of flowers while the model is running. For example, changing the model from a 2x2 grid to a 3x3 grid might put five new flowers into the population, all based on the previously selected parent.

Change the way the parents' genes are passed on in sexual reproduction and how they are expressed.


This model uses a breed of invisible spawners to keep track of each flower.




This model is loosely based on the Biomorphs discussed at length in Richard Dawkins' The Blind Watchmaker (1986).

In Dawkins' original model, the user was presented with a series of "insects" that were drawn based on nine separate values. For example, if insect A has a "leg-length" value of 2 and insect B has a "leg-length" value of 1, then insect A would be drawn with longer legs. These 9 variables were thus the genotype of each insect-like creature, and the drawing based on those numbers was the phenotype. If the user clicked on an insect (or "biomorph"), then all the insects would be erased and the chosen biomorph would be used as the basis for a new population of biomorphs. Each variable would be mutated slightly in the new generation (representing the inheriting of a slightly higher or lower value for the genotype), and these mutated values would be used in the new population of the biomorphs. In this manner, the new generation of biomorphs resembled the previously chosen biomorph, with some variation. For example, if you chose a biomorph with an exceptionally long abdomen, then, because they are all modified versions of the chosen biomorph, biomorphs in the next generation would tend to have longer abdomens than previously.

In this model, "flowers" are used as the biomorphs instead of the insect-like creatures Dawkins used; furthermore, these biomorphs only vary among four variables--num-color, step-size, size-modifier, and turn-increment--and not nine. The idea is very similar, though. The user is presented with a number of flowers. By clicking on a flower, the user can choose the type of flower that will populate the next generation. If ASEXUAL? is false, the user picks two biomorphs instead of just one; the next generation will be produced by selecting one the values for each of the four genotype variables from either one of the parents.

Thanks to Nate Nichols for his work on this model.


If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:

  • Nichols, N. and Wilensky, U. (2006). NetLogo Sunflower Biomorphs model. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
  • Wilensky, U. (1999). NetLogo. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.


Copyright 2006 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

;; spawners are hidden turtles at the center of each "flower" that
;; are always hatching the petals you actually see
breed [spawners spawner]
breed [petals petal]

globals [
  first-parent     ;; the first parent chosen if sexual reproduction is being used

spawners-own [
  num-colors       ;; how many colors the petals will have
  step-size        ;; how fast petals move out (the flower's rate of growth)
  turn-increment   ;; how much each petal is rotated before moving out from
                   ;; the center; for example, a turn-increment of 0 will
                   ;; cause all the petals to move out on the same line
  size-modifier    ;; how quickly the petals grow as they move away from
                   ;; their starting location

petals-own [
  step-size        ;; same as for spawners
  size-modifier    ;; same as for spawners
  parent           ;; spawner that spawned this petal; distance from parent
                   ;; is used for calculating the petal's size as it grows

to setup
  create-spawners rows * columns
    set num-colors random 14 + 1
    set step-size random-float 0.5
    set turn-increment random-float 4.0
    set size-modifier random-float 2.0
    hide-turtle        ;; we don't want to see the spawners
  set first-parent nobody

to arrange-spawners
  ;; arrange the spawners around the world in a grid
  let i 0
  while [i < rows * columns]
    ask turtle i
      let x-int world-width / columns
      let y-int world-height / rows
      setxy (-1 * max-pxcor + x-int / 2 + (i mod columns) * x-int)
            (max-pycor + min-pycor / rows - int (i / columns) * y-int)
    set i i + 1

to go
  ask spawners
    hatch-petals 1
      set parent myself
      set color 10 * (ticks mod ([num-colors] of parent + 1)) + 15
      rt ticks * [turn-increment] of parent * 360
      set size 0
      show-turtle  ;; the petal inherits the hiddenness of its parent,
                   ;; so this makes it visible again
  ask petals
    fd step-size
    set size size-modifier * sqrt distance parent
    ;; Kill the petals when they would start interfering with petals from other flowers.
    if abs (xcor - [xcor] of parent) > max-pxcor / (columns * 1.5) [ die ]
    if abs (ycor - [ycor] of parent) > max-pycor / (rows * 1.5) [ die ]
  if mouse-down? [ handle-mouse-down ]

to repopulate-from-two [parent1 parent2]
  ask petals [ die ]
  ask spawners
    ;;if controlled-mutation? then the mutation a flower experiences is relative to its spawner's who number.
    if controlled-mutation? [set mutation who * 1 / (rows * columns)]

    ;; select one value from either parent for each of the four variables
    set num-colors ([num-colors] of one-of list parent1 parent2) + int random-normal 0 (mutation * 10) mod 15 + (1)
    set step-size ([step-size] of one-of list parent1 parent2) + random-normal 0 (mutation / 5)
    set turn-increment ([turn-increment] of one-of list parent1 parent2) + random-normal 0 (mutation / 20)
    set size-modifier ([size-modifier] of one-of list parent1 parent2) + random-normal 0 mutation

    ;;We clamp size-modifier so none of the sunflowers get too big.
    if size-modifier > 1.5 [set size-modifier 1.5]

to repopulate-from-one [parent1]
  ask petals [ die ]
  ask spawners
    if controlled-mutation? [ set mutation who * 1 / (rows * columns) ]
    set num-colors ([num-colors] of parent1 + int random-normal 0 (mutation * 10)) mod 15 + 1
    set step-size [step-size] of parent1 + random-normal 0 (mutation / 5)
    set turn-increment [turn-increment] of parent1 + random-normal 0 (mutation / 20)
    set size-modifier [size-modifier] of parent1 + random-normal 0 mutation

    ;;We clamp size-modifier so none of the sunflowers get too big.
    if size-modifier > 1.5 [ set size-modifier 1.5 ]

to handle-mouse-down
  ;; get the spawner closest to where the user clicked
  let new-parent min-one-of spawners [distancexy mouse-xcor mouse-ycor]
  ifelse asexual?
  [ repopulate-from-one new-parent ]
    ifelse first-parent != nobody
      repopulate-from-two first-parent new-parent
      set first-parent nobody
      ask patches [ set pcolor black ]
      set first-parent new-parent
      ask patches
        ;; This is a little tricky; some patches may be equidistant
        ;; from more than one spawner, so we can't just ask for the
        ;; closest spawner, we have to ask for all the closest spawners
        ;; and then see if the clicked spawner is among them
        if member? new-parent spawners with-min [distance myself]
          [ set pcolor gray - 3 ]
  ;; wait for the user to release mouse button
  while [mouse-down?] [ ]

; Copyright 2006 Uri Wilensky.
; See Info tab for full copyright and license.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 9 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 10 years ago Updated version tag Download this version
Uri Wilensky over 10 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky about 11 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 12 years ago Sunflower Biomorphs Download this version

Attached files

File Type Description Last updated
Sunflower Biomorphs.png preview Preview for 'Sunflower Biomorphs' almost 10 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.