MIHS-18 Flower Petal Evolution Lina Winiski & Lauren Ball P4
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This model represents evolution where the user selects which genes are favored. The "sunflowers" can reproduce either asexually or sexually. Mutations are possible, which can heighten the variety of the types of petals of the sunflowers.
HOW IT WORKS
The flowers have four genes that determine the petals expressed. When flowers are selected for reproduction, a new generation with these genes is created. There will be mutations based on the mutation rate.
Every flower is made up of a "spawner" - the center of the flower - and petals. Petals are created from the spawner where each of the four separate genes are held. Each flower has a "box" and if the petals move of that, they will die and disappear.
There are two options for the types of reproduction: asexual and sexual. The next generation is based off of the parents. If spawners not producing petals and are selected, the following generation will produce less petals.
Butterflies, defined in the code as bees, fly around the model in the desired number and are trapped within the grid.
HOW TO USE IT
First, using the slider, define the desired amount of bees, flowers, and the level of mutations. The lower the mutation rate, the more the child generation will reflect the traits of the parent flowers.
If the reproduction is set to asexual, the following generation will be based off of the traits of the spawner closest to where you click. If sexual reproduction is selected, the next generation will be based off of two spawners you click on.
THINGS TO TRY
Try to see how you can favor certain genes and narrow the amount of variety. Also see how many different selections are possible. You could also try to recreate petal patterns that were "evolved" out of existence.
EXTENDING THE MODEL
You can modify the type of reproduction while the model is still running.
NETLOGO FEATURES
Sliders and switches are heavily utilized. We also used multiple breeds (spawners, petals, bees) as well as shapes to help clarify the imagery of the model.
RELATED MODELS
Sunflower Biomorphs (by Uri Wilensky)
CREDITS AND REFERENCES
This model was based off Uri Wilensky's Sunflower Biomorphs model. This model used a grid formation to place the sunflowers and had the spawners be invisible. It also lacked the presence of the bees.
Comments and Questions
;; 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] breed [bees bee] 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 clear-all create-spawners initial-number-sunflowers [ 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 set shape "circle" set size 0.5 ] arrange-spawners set first-parent nobody ask patches [ set pcolor cyan + 2 ] reset-ticks create-bees initial-number-bees ;; makes bees [ set color yellow set size 2 ;; stands out against petals setxy random-xcor random-ycor set shape "butterfly" ] end to arrange-spawners ;; arrange the spawners around the world in a grid let i 0 while [i < initial-number-sunflowers ] [ ask turtle i [ setxy random-xcor random-ycor ] set i i + 1 ] end 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 ] ] tick if mouse-down? [ handle-mouse-down ] ask bees [ move ] end to move rt random 50 lt random 50 fd 1 end 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] ] ask patches [ set pcolor cyan + 2 ] end 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 ] ] ask patches [ set pcolor cyan + 2 ] end 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?] [ ] ask patches [ set pcolor cyan + 2 ] end ; Copyright 2006 Uri Wilensky. ; See Info tab for full copyright and license.
There is only one version of this model, created over 6 years ago by Lina Winiski.
Attached files
No files
This model does not have any ancestors.
This model does not have any descendants.