Bird Breeder
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This is a model of a selective breeding program of birds (or dragons). In the scenario presented in the model the user assumes the role of a bird breeder, whose goal is breed a line of "fancy" looking birds or a specific type of dragon through managing a selective breeding program.
HOW IT WORKS
In the "birds" scenario the user breeds have a simple genetic representation for five traits: Crest color, wing color, breast color, tail color, and sex.
In the "birds" scenario these traits are represented with genes that have one of two possible alleles each (A and a, B and b, C and c, D and d, and W and Z, respectively). Upper case letters represent dominant genes and lower case represent recessive genes. Therefore the three combinations AA, Aa, and aA result in expression of the trait for A (e.g. gray crest), and only aa results in the expression of the trait for a (e.g. red crest). Males and Females are determined by whether the bird has ZZ (male) or WZ (female) genetic information. One trait, crest color, is sex linked. Male birds (ZZ) display a crest on their head, while females (WZ) do not (though they still carry the genetic information for how it should be expressed if they were male).
In the "dragons" scenario the user breeds have a simple genetic representation for four traits: body color, breath type, breast color, tail shape, and sex.
In the "dragons" scenario these traits are represented with genes that have one of two possible alleles each (A and a, B and b, C and c, D and d, and W and Z, respectively). Females and males can be distinguished by the shape of their wings. Upper case letters do not represent dominant genes in this scenario. Gene expression follows rules for co-dominance, where both genes are expressed, resulting in a mixed or dual expression of the genes. For example, A represents yellow coloring, a represents red coloring, so AA will be expressed as yellow, Aa will be expressed as orange, aA also will be expressed as orange, and aa will be expressed as red.
Here is the genotype to phenotype maps for both scenarios:
Bird Scenario: Crest color: (AA, Aa, aA) grey or (aa) blue Wing color: (BB, Bb, bB) grey or (bb) red
Breast color: (CC, Cc, cC) grey or (cc) purple Tail color: (DD, Dd, dD) grey or (dd) red
Dragon Scenario: Body color: (AA) yellow or (Aa, aA) orange or (aa) red
Breath type: (BB) frost breath or (Bb, bB) steam breath or (bb) fire breath
Breast color: (CC) black or (Cc, cC) grey or (cc) white
Tail shape: (DD) spade or (Dd, dD) rope and spade or (dd) rope
HOW TO USE IT
There are 4 players in this selective breeding scenario and you are one of them. The other three are computer players. Each of the computer players take a passive role in the breeding of birds, but serve as sources for out-breeding your own stock of birds. You start with 3 birds you own in your six cages (at the bottom of the world).] There are 6 breeding locations (color coded) in the middle of the world. When move (using your mouse) one male and one female bird into a breeding location and press BREED-BIRDS, eggs will hatch. You may drag the eggs back to your cages to see what the birds look like and keep them. To set a bird free, just click drag it into the white space in the world and release the mouse button. You can only set birds free that you own.
You start with $500 and are trying to earn at least the target $ reward for success (set with the slider REWARD-FOR-SUCCESS. Each breeding event also has an assigned cost $ (COST-FOR-BREEDING). If you wish to breed your birds with another player's, you may press the REQUEST CONTRIBUTION BIRDS button. This will cost COST-CONTRIBUTION (set by this slider) for each bird contributed.
Initial settings (chooser):
- SCENARIO: chooser that determines whether you will be breeding "birds" or "dragons".
Buttons:
- SETUP: Press this first to assign the SCENARIO you will be playing
GO: Press this second to start the breeding challenge
NEXT INSTRUCTION: Use this to display a series of instructions about how to user the interface and mouse interactions with the birds.
REQUEST CONTRIBUTION BIRDS FOR BREEDING: When pressed one bird from each computer player is loaned for breeding to one of the top three breeding sites.
- BREED CURRENT BIRDS AT BREEDING SITE: When pressed, all breeding sites that have at least one male and one female in them will produce a set of eggs in the remaining available spaces (up to four at that breeding site). If more than one male or females are at that site, only one female and male will breed.
- REMOVE ALL EGGS FROM BREEDING SITES: Removes all eggs currently in all breeding sites.
- SELL GOAL BIRD: Attempts to sell the bird you have been trying to breed. This will generate either a warning (if you don't have the bird yet in your cages) or a reward message if you do have the bird. If you have the bird, the bird is removed from your cages and you will be given $, set by the REWARD-FOR-GOAL-BIRD slider.
Sliders:
- COST-BREEDING: cost in $ for every pair of birds that you breed.
- COST-CONTRIBUTION: cost in $ of pressing the REQUEST CONTRIBUTION BIRDS.
- REWARD-FOR-GOAL-BIRD: $ rewarded for selling one goal bird.
Switches:
- SHOW-GENETICS?: Show the Mendelian representation of the genes that each bird or egg has.
Monitors:
- Your funds $: Shows the money you currently have in your bank account.
THINGS TO NOTICE
Even though birds produce four eggs when they mate, the four eggs may or may not produce the expected probabilities of a theoretical Punnett square. This is because, of course that expected probabilities, represent what would result after an infinite set of crosses.
THINGS TO TRY
See if you can breed for the fancy bird in the least number of generations.
Write down the breeding plan you followed to create a line of the fancy bird. Create a pedigree diagram to show the series of generations and breeding events that led to the fancy bird.
EXTENDING THE MODEL
The model shows two different scenarios, "birds" and "dragons". Other possible could be added such as virtual dogs, cats, corn, etc...
The model could be extended to a HubNet version, where all four players are active competitors in the selective breeding challenge.
RELATED MODELS
Plant Hybridization model.
CREDITS AND REFERENCES
This model is part of the BEAGLE curriculum (http://ccl.northwestern.edu/simevolution/beagle.shtml)
HOW TO CITE
If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:
- Novak, M. and Wilensky, U. (2007). NetLogo Bird Breeder model. http://ccl.northwestern.edu/netlogo/models/BirdBreeder. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
COPYRIGHT AND LICENSE
Copyright 2007 Uri Wilensky.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ 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 uri@northwestern.edu.
Comments and Questions
globals [ genes-to-phenotype ;; list that contains a map of genotype to phenotype bird-body-color your-cage-color user-1-color user-2-color user-3-color this-site-id my-id ;; ids that keep track of user and breeding sites parent-female parent-male ;; the two parents of any potential eggs frequency-allele-dominant-second-trait ;; used for keeping track of allele frequencies frequency-allele-dominant-first-trait frequency-allele-recessive-second-trait frequency-allele-recessive-first-trait frequency-allele-dominant-third-trait frequency-allele-recessive-third-trait frequency-allele-dominant-fourth-trait frequency-allele-recessive-fourth-trait second-trait-shape-1 second-trait-shape-2 second-trait-shape-3 fourth-shape-1 fourth-shape-2 fourth-shape-3 bird-size current-funds ;; money the user has available instruction ;; which instruction the user is viewing ] breed [birds bird] breed [first-traits first-trait] ;; shape that is the crest in birds and the wings in dragons breed [second-traits second-trait] ;; shape that is the wings in birds and breath in dragons breed [third-traits third-trait] ;; shape that determines breast in birds and in dragons breed [fourth-traits fourth-trait] ;; shape that determines tail in birds and in dragons breed [cages cage] breed [users user] patches-own [site-id owner] birds-own [first-genes second-genes third-genes fourth-genes fifth-genes sex-gene selected? owned-by] first-traits-own [first-genes second-genes third-genes fourth-genes fifth-genes sex-gene selected? owned-by] second-traits-own [first-genes second-genes third-genes fourth-genes fifth-genes sex-gene selected? owned-by] third-traits-own [first-genes second-genes third-genes fourth-genes fifth-genes sex-gene selected? owned-by] fourth-traits-own [first-genes second-genes third-genes fourth-genes fifth-genes sex-gene selected? owned-by] users-own [user-id moving-a-bird?] ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; setup procedures ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to make-users create-users 1 [set user-id 1 set hidden? true] create-users 1 [set user-id 2 set hidden? true] create-users 1 [set user-id 3 set hidden? true] end to setup clear-all make-users set instruction 0 set this-site-id 0 set parent-female nobody set parent-male nobody set current-funds 500 set bird-size 0.8 ask patches [set pcolor white] set your-cage-color (turquoise + 4) set user-1-color (pink + 4) set user-2-color (green + 4) set user-3-color (brown + 4) set bird-body-color (gray + 2.5) set-scenario set-default-shape cages "cage" setup-my-cages setup-breeding-sites set my-id 4 calculate-all-alleles visualize-genetics give-instructions end to set-scenario if scenario = "birds" [ set-default-shape birds "bird" set-default-shape first-traits "bird-cap" set-default-shape second-traits "bird-wing" set-default-shape third-traits "bird-breast" set-default-shape fourth-traits "bird-tail" set-default-shape cages "cage" set genes-to-phenotype [ ["AA" "set color gray"] ["Aa" "set color gray"] ["aA" "set color gray"] ["aa" "set color sky"] ;; sets crest colors ["BB" "set color gray"] ["Bb" "set color gray"] ["bB" "set color gray"] ["bb" "set color red"] ;; sets wing colors ["CC" "set color gray"] ["Cc" "set color gray"] ["cC" "set color gray"] ["cc" "set color magenta"] ;; sets breast colors ["DD" "set color gray"] ["Dd" "set color gray"] ["dD" "set color gray"] ["dd" "set color red" ] ;; sets tail colors ] ] if scenario = "dragons" [ set-default-shape birds "dragon-body" ;; one shape for the dragon body set second-trait-shape-1 "dragon-breath-fire" ;; three variations of shape for the breath trait set second-trait-shape-2 "dragon-breath-cloud" set second-trait-shape-3 "dragon-breath-ice" set-default-shape third-traits "dragon-chest" ;; one shape for the chest trait set fourth-shape-1 "dragon-tail-spade" ;; three variations of shape for the tail trait set fourth-shape-2 "dragon-tail-rope-spade" set fourth-shape-3 "dragon-tail-rope" set genes-to-phenotype [ ["AA" "set color (yellow - 1)"] ["Aa" "set color orange"] ["aA" "set color orange"] ["aa" "set color red"] ;; sets body color ["BB" "set shape second-trait-shape-3"] ["Bb" "set shape second-trait-shape-2"] ["bB" "set shape second-trait-shape-2"] ["bb" "set shape second-trait-shape-1"] ;; fire shape ["CC" "set color (gray - 2.5)"] ["Cc" "set color (gray + 1)"] ["cC" "set color (gray + 1)"] ["cc" "set color white"] ;; sets breast color ["DD" "set shape fourth-shape-1"] ["Dd" "set shape fourth-shape-2"] ["dD" "set shape fourth-shape-2"] ["dd" "set shape fourth-shape-3" ] ;; sets tail shape ] ] end to give-instructions set instruction (instruction + 1) if instruction = 11 [set instruction 1] if instruction = 1 [ output-print " " output-print " " output-print "You will be running a selective" output-print "breeding program, attempting to" output-print "develop a breed of fancy looking" output-print "birds." output-print "Press NEXT INSTRUCTION to continue." ] if instruction = 2 [ output-print " " output-print " " output-print "There are 4 players in this" output-print "selective breeding program and " output-print "you are one of them." output-print "Press NEXT INSTRUCTION to continue." ] if instruction = 3 [ output-print " " output-print " " output-print "You are player 4, (blue). You" output-print "start with 3 birds you own in" output-print "your six cages (at the bottom" output-print "of the world)." output-print "Press NEXT INSTRUCTION to continue." ] if instruction = 4 [ output-print " " output-print " " output-print "There are 6 breeding locations" output-print "(which are color coded) in the" output-print "middle of the world." output-print "Press NEXT INSTRUCTION to continue." ] if instruction = 5 [ output-print " " output-print " " output-print "If you move (using your mouse)" output-print "one male and one female bird" output-print "into a breeding location and" output-print "and press BREED-BIRDS, eggs" output-print "will hatch." output-print "Press NEXT INSTRUCTION to continue." ] if instruction = 6 [ output-print " " output-print " " output-print "You may drag the eggs back to" output-print "your cages to see what the birds" output-print "look like and keep them." output-print "Press NEXT INSTRUCTION to continue." ] if instruction = 7 [ output-print " " output-print "" output-print "To set a bird free (that you own)," output-print "click the mouse button and hold" output-print "and drag into the white space" output-print "the mouse button." output-print "Press NEXT INSTRUCTION to continue." ] if instruction = 8 [ output-print " " output-print " " output-print " " output-print "You start with $500 and are" output-print (word "trying to earn at least $" reward-for-goal-bird ".") output-print "Press NEXT INSTRUCTION to continue." ] if instruction = 9 [ output-print " " output-print " " output-print (word "Each breeding event cost $" cost-for-breeding ".") output-print "If you wish to breed your birds" output-print "with another player's you may " output-print "press REQUEST CONTRIBUTION BIRDS." output-print (word "This will cost $" cost-contribution " for each bird") output-print "contributed." output-print "Press NEXT INSTRUCTION to continue." ] if instruction = 10 [ output-print " " output-print " " output-print " " output-print "Press GO if you are ready to begin." output-print "These instructions can be repeated" output-print "by pressing NEXT INSTRUCTION." ] end to setup-birds let this-cage owner sprout 1 [ build-body-base set owned-by this-cage assign-all-genes build-body-parts ] end to setup-my-cages let these-cages nobody set these-cages patches with [pxcor = -4 and pycor <= 3 and pycor >= -2] ask these-cages [set pcolor user-1-color set owner 1 sprout 1 [set breed cages set shape "cage"]] ask n-of 3 these-cages [setup-birds] set these-cages patches with [pxcor <= 3 and pxcor >= -2 and pycor = 5] ask these-cages [set pcolor user-2-color set owner 2 sprout 1 [set breed cages set shape "cage"]] ask n-of 3 these-cages [setup-birds] set these-cages patches with [pxcor = 5 and pycor >= -2 and pycor <= 3] ask these-cages [set pcolor user-3-color set owner 3 sprout 1 [set breed cages set shape "cage"]] ask n-of 3 these-cages [setup-birds] set these-cages patches with [pycor = -4 and pxcor >= -2 and pxcor <= 3] ask these-cages [set pcolor your-cage-color set owner 4 sprout 1 [set breed cages set shape "cage"]] ask n-of 3 these-cages [setup-birds] ask patch 1 -3 [set plabel "These are your cages" set plabel-color black] ask patch 2 4 [set plabel "These are the six breeding sites " set plabel-color black] ask patch -4 4 [set plabel "Player 1 " set plabel-color black] ask patch 5 4 [set plabel "Player 3 " set plabel-color black] ask patch -3 5 [set plabel "Player 2 " set plabel-color black] end to setup-breeding-sites ask patches with [pxcor >= -2 and pxcor <= -1 and pycor <= 3 and pycor >= 1] [set pcolor user-1-color set site-id 1] ask patches with [pxcor >= 0 and pxcor <= 1 and pycor <= 3 and pycor >= 1] [set pcolor user-2-color set site-id 2] ask patches with [pxcor >= 2 and pxcor <= 3 and pycor <= 3 and pycor >= 1] [set pcolor user-3-color set site-id 3] ask patches with [pxcor >= -2 and pxcor <= -1 and pycor <= 0 and pycor >= -2] [set pcolor (your-cage-color - .2) set site-id 4] ask patches with [pxcor >= 0 and pxcor <= 1 and pycor <= 0 and pycor >= -2] [set pcolor (your-cage-color + .2) set site-id 5] ask patches with [pxcor >= 2 and pxcor <= 3 and pycor <= 0 and pycor >= -2] [set pcolor (your-cage-color - .2) set site-id 6] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; runtime procedures ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to go listen-move-birds listen-free-birds hatch-eggs visualize-genetics calculate-all-alleles end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; check for meeting goals procedures ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to check-for-goal let winning-text "" let potential-winners birds with [my-id = owned-by and shape != "egg" and is-goal-bird?] let winner nobody if any? potential-winners [ set winner one-of potential-winners set current-funds (current-funds + reward-for-goal-bird) set winning-text "You bred the desired bird and received $1000 from a bird collector! " if current-funds > 500 [set winning-text (word winning-text " And you ended up with more money ($" current-funds ") than you started with!")] if current-funds < 500 [set winning-text (word winning-text " But you ended up with less money ($" current-funds ") than you started with!")] if current-funds < 0 [set winning-text (word winning-text " And actually are in debt at this point.")] ask winner [ask out-link-neighbors [die] die] user-message winning-text ] ;;[set winning-text "You have not bred the desired bird yet. No one wants to buy any of the other birds you have."] end to visualize-genetics ask birds [ set label-color black ifelse show-genetics? [ set label (word first-genes " " second-genes " " fourth-genes " " third-genes " " sex-gene) ] ;; show the representation of the genes this bird has [set label owned-by] ;; show the player id that owns this bird ] end to contribute-birds ;; select birds from other players to put in breeding sites ;; (each other player will contribute one bird to one of three breeding sites) let open-sites patches with [not any? birds-here and site-id >= 1 and site-id <= 3] let target-site nobody let this-user-id 0 let distance-to-target 0 ask users [ set current-funds (current-funds - cost-contribution) set this-user-id user-id set target-site one-of open-sites with [this-user-id = site-id and not any? users-here] ask one-of birds with [this-user-id = owned-by] [setxy ([pxcor] of target-site) ([pycor] of target-site)] set moving-a-bird? true ] end to return-birds ;; return other players birds to their cages let target-cage nobody let this-owner 0 ask birds with [owned-by != my-id and owned-by = site-id] [ set this-owner owned-by set target-cage one-of patches with [owner = this-owner and not any? birds-here] setxy ([pxcor] of target-cage) ([pycor] of target-cage) ] end to share-others-birds ;; request for other players to share their birds for breeding involves two steps return-birds contribute-birds end to calculate-all-alleles ;; check to make sure one of each allele exists somewhere in the starting population ;; otherwise breeding for the target bird would be impossible set frequency-allele-dominant-first-trait (count birds with [(item 0 first-genes) = "A"]) + (count birds with [(item 0 first-genes) = "A"]) set frequency-allele-recessive-first-trait (count birds with [(item 1 first-genes) = "a"]) + (count birds with [(item 1 first-genes) = "a"]) set frequency-allele-dominant-second-trait (count birds with [(item 0 second-genes) = "B"]) + (count birds with [(item 0 second-genes) = "B"]) set frequency-allele-recessive-second-trait (count birds with [(item 1 second-genes) = "b"]) + (count birds with [(item 1 second-genes) = "B"]) set frequency-allele-dominant-third-trait (count birds with [(item 0 third-genes) = "C"]) + (count birds with [(item 0 third-genes) = "C"]) set frequency-allele-recessive-third-trait (count birds with [(item 1 third-genes) = "c"]) + (count birds with [(item 1 third-genes) = "c"]) set frequency-allele-dominant-fourth-trait (count birds with [(item 0 fourth-genes) = "D"]) + (count birds with [(item 0 fourth-genes) = "D"]) set frequency-allele-recessive-fourth-trait (count birds with [(item 1 fourth-genes) = "d"]) + (count birds with [(item 1 fourth-genes) = "d"]) ifelse (both-second-trait-alleles-exist? and both-first-trait-alleles-exist? and both-fourth-alleles-exist? and both-third-trait-alleles-exist? and both-sexes-exist?) [] [user-message (word "The current of birds in all the cages of all the player does not have" "enough genetic diversity for it to be possible for you to find a way to develop the desired breed." " Press SETUP to start the model over and try again.") ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; breed birds ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to breed-birds ask turtles with [shape = "egg"] [die] ask birds with [is-female? and site-id != 0 and not selected? ] [ set this-site-id site-id set parent-female self if (has-one-mate?) [ make-eggs ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; make and convert eggs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to hatch-eggs ask birds with [shape = "egg" and in-cage? and not selected?] [ build-body-base build-body-parts ] end to make-eggs set current-funds (current-funds - cost-for-breeding) let open-patches patches with [site-id = this-site-id and not any? birds-here] ask open-patches [sprout 1 [make-an-egg]] end to make-an-egg set breed birds assign-genetics-from-parents set shape "egg" set color blue set selected? false set size 0.5 set owned-by my-id end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; build birds ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to build-body-base set breed birds if scenario = "birds" [ set shape "bird" ] if scenario = "dragons" [set shape "dragon-body"] set size bird-size set selected? false set color bird-body-color end to assign-all-genes set first-genes (word random-first-genes random-first-genes) set second-genes (word random-second-genes random-second-genes) set third-genes (word random-third-genes random-third-genes) set fourth-genes (word random-fourth-genes random-fourth-genes) set sex-gene random-sex-genes end to build-body-parts let body-label label set label "" ;; temporarily remove the label during building the body parts set size bird-size if scenario = "birds" [ if is-male? [ hatch 1 [run lookup-phenotype-for-gene first-genes set breed first-traits create-link-from myself [tie] ] ] hatch 1 [run lookup-phenotype-for-gene second-genes set breed second-traits create-link-from myself [tie] ] hatch 1 [run lookup-phenotype-for-gene fourth-genes set breed fourth-traits create-link-from myself [tie] ] hatch 1 [run lookup-phenotype-for-gene third-genes set breed third-traits create-link-from myself [tie] ] ] if scenario = "dragons" [ run lookup-phenotype-for-gene first-genes hatch 1 [set breed second-traits run lookup-phenotype-for-gene second-genes create-link-from myself [tie] ] ifelse is-male? [hatch 1 [set breed first-traits set shape "dragon-wing-male" create-link-from myself [tie] ]] [hatch 1 [set breed first-traits set shape "dragon-wing-female" create-link-from myself [tie] ]] hatch 1 [set breed second-traits run lookup-phenotype-for-gene second-genes create-link-from myself [tie] ] hatch 1 [set breed third-traits run lookup-phenotype-for-gene third-genes create-link-from myself [tie] ] hatch 1 [set breed fourth-traits run lookup-phenotype-for-gene fourth-genes create-link-from myself [tie] ] ] set label body-label end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; move the birds ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to listen-move-birds let snap-xcor mouse-xcor let snap-ycor mouse-ycor let birds-selected nobody let birds-available nobody if mouse-inside? [ set birds-selected (birds with [selected?]) ask birds-selected [setxy snap-xcor snap-ycor] ;; move previously selected birds to the mouse location if (mouse-down? and not any? birds-selected) [ ;; if the mouse is down and nothing was selected, then select a bird set birds-available birds with [pxcor = round snap-xcor and pycor = round snap-ycor and is-my-bird?] if any? birds-available [ ask n-of 1 birds-available [ set selected? true ] ] ] if (count birds with [pxcor = round snap-xcor and pycor = round snap-ycor] = 1) [ ;; there is only one bird at this patch (the one being moved there) if (not mouse-down?) [ ;; bird is released to this patch if it owned by the user or is communal ask (birds-selected with [my-id = owner or owner = 0]) [set selected? false setxy pxcor pycor ] ] ] ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; free the birds or eggs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to listen-free-birds ask birds with [owner = 0 and site-id = 0 and not selected?] [remove-bird] end to remove-bird ask other turtles-here [die] die end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;; reporters ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to assign-genetics-from-parents set first-genes inherited-first-genes set third-genes inherited-third-genes set second-genes inherited-second-genes set fourth-genes inherited-fourth-genes set sex-gene inherited-sex-genes end to-report inherited-first-genes let mother-loci (random 2) let father-loci (random 2) let mother-allele "" let father-allele "" ask parent-female [set mother-allele (item mother-loci first-genes)] ask parent-male [set father-allele (item father-loci first-genes)] report (word mother-allele father-allele) end to-report inherited-third-genes let mother-loci (random 2) let father-loci (random 2) let mother-allele "" let father-allele "" ask parent-female [set mother-allele (item mother-loci third-genes)] ask parent-male [set father-allele (item father-loci third-genes)] report (word mother-allele father-allele) end to-report inherited-second-genes let mother-loci (random 2) let father-loci (random 2) let mother-allele "" let father-allele "" ask parent-female [set mother-allele (item mother-loci second-genes)] ask parent-male [set father-allele (item father-loci second-genes)] report (word mother-allele father-allele) end to-report inherited-fourth-genes let mother-loci (random 2) let father-loci (random 2) let mother-allele "" let father-allele "" ask parent-female [set mother-allele (item mother-loci fourth-genes)] ask parent-male [set father-allele (item father-loci fourth-genes)] report (word mother-allele father-allele) end to-report inherited-sex-genes let mother-loci (random 2) let father-loci (random 2) let mother-allele "" let father-allele "" ask parent-female [set mother-allele (item mother-loci sex-gene)] ask parent-male [set father-allele (item father-loci sex-gene)] report (word mother-allele father-allele) end to-report random-first-genes ifelse random 2 = 0 [report "A"] [report "a"] end to-report random-second-genes ifelse random 2 = 0 [report "B"] [report "b"] end to-report random-third-genes ifelse random 2 = 0 [report "C"] [report "c"] end to-report random-fourth-genes ifelse random 2 = 0 [report "D"] [report "d"] end to-report random-sex-genes ifelse random 2 = 0 [report "WZ"] [report "ZZ"] end to-report is-male? ifelse sex-gene = "ZZ" [report true] [report false] end to-report is-female? ifelse sex-gene = "WZ" [report true] [report false] end to-report has-one-mate? let birds-at-site-id birds-on patches with [site-id = this-site-id] let report? false let eligible-males birds-at-site-id with [is-male?] if (count eligible-males = 1) [ set report? true set parent-male one-of eligible-males ] report report? end to-report in-cage? ifelse (owner != 0) [report true] [report false] end to-report both-sexes-exist? ifelse (any? birds with [is-male?] and any? birds with [is-female?]) [report true] [report false] end to-report both-second-trait-alleles-exist? ifelse (frequency-allele-dominant-second-trait > 0 and frequency-allele-recessive-second-trait > 0) [report true] [report false] end to-report both-third-trait-alleles-exist? ifelse (frequency-allele-dominant-third-trait > 0 and frequency-allele-recessive-third-trait > 0) [report true] [report false] end to-report both-fourth-alleles-exist? ifelse (frequency-allele-dominant-fourth-trait > 0 and frequency-allele-recessive-fourth-trait > 0) [report true] [report false] end to-report both-first-trait-alleles-exist? ifelse (frequency-allele-dominant-first-trait > 0 and frequency-allele-recessive-first-trait > 0) [report true] [report false] end to-report is-my-bird? ifelse my-id = owned-by [report true] [report false] end to-report is-goal-bird? ifelse ( first-genes = "aa" and second-genes = "bb" and third-genes = "cc" and fourth-genes = "dd" ) [report true] [report false] end to-report lookup-phenotype-for-gene [x] let item-counter 0 let target-phenotype 0 let target-item 0 repeat length genes-to-phenotype [ if (item 0 (item item-counter genes-to-phenotype)) = x [set target-phenotype (item 1 (item item-counter genes-to-phenotype))] set item-counter (item-counter + 1) ] set item-counter 0 report target-phenotype end ; Copyright 2007 Uri Wilensky. ; See Info tab for full copyright and license.
There are 11 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Bird Breeder.png | preview | Preview for 'Bird Breeder' | over 11 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.