Goldfish breeding-Artificial selection

Goldfish breeding-Artificial selection preview image

1 collaborator

Screen_shot_2018-02-02_at_12.53.50_pm lin xiang (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.0 • Viewed 148 times • Downloaded 22 times • Run 0 times
Download the 'Goldfish breeding-Artificial selection' 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

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

Click to Run Model

globals [x y fish-color name]

breed [fish a-fish]
breed [weeds weed]
breed [pebbles pebble]
breed [foods food]

to-report min-color
  report (round min [color] of fish) - 0.5
end 

to-report max-color
  report (round max [color] of fish) + 0.5
end 

to-report generation
  report ticks / 25000
end 

to setup
  ca

ask patches [set pcolor 87.5]
ask patches with [pycor = min-pycor] [set pcolor 35]


  create-fish 30                                                                              ;set fish
  [set color 24 + random-float 3
    set heading 90
    ifelse heading >= 0 or heading <= 180 [set shape "fish-ll"][set shape "fish-rr"]
    set size 5
    set label round color

   setposition
  ]


create-weeds 1 + random 2                                                                      ;set aquatic plants
[set color green
  set size 10 + random 3
  set shape "weed"
  setxy random-xcor min-pycor + 6 + random 2]


create-pebbles 300                                                                              ;set pebbles
[set size 1 + random-float 1.5
  set color 34 + random 5
  set shape "pebble"
  setxy random-xcor min-pycor + random-float 1.5]


  reset-ticks
end 

to setposition
  ifelse turtles-here != nobody [setxy random-xcor random-ycor][setposition]
end 

to go
  tick
every 0.1 [
swim
fish-grow
death
reproduce
pick-a-fish
do-plot]
end 

to swim
     ask fish [
    rt random-float 45
    lt random-float 45
     if [pycor] of patch-ahead 1 < min-pycor + 3 [set heading random 90]                          ;move up if get to the bottom
     if [pycor] of patch-ahead 1 > max-pycor - 3 [set heading 90 + random 90]                     ; move down if get to the surface
    ifelse heading >= 0 and heading <= 180 [set shape "fish-ll"][set shape "fish-rr"]               ; set fish side aligned with heading
    fd 0.3
     ]
end 

to set-shape
  ask turtles
  [ifelse heading >= 0 or heading <= 180 [set shape "fish 9"][set shape "fish 8"]]
end 

to death
  ask fish [if count fish >= 30 [if random 100 < 1 [die]]]
end 

to reproduce
  ask fish with [size = 5] [if count fish < 30 [hatch 1 [set color (color - 1 + random-float 2) round-color set size 0.5 set label round color setxy random-xcor min-pycor + 3 + random 2]]]
end 

to fish-grow
  ask fish [if size < 5 [set size size + 0.2]]
end 

to round-color
  if round color = 9 or round color = 10 [set color 12]
    if round color = 19 or round color = 20 [set color item random 2 [ 18 22]]
    if round color = 29 or round color = 30 [set color item random 2 [ 28 32]]
   if round color = 39 or round color = 40 [set color item random 2 [ 38 42]]
   if round color = 49 or round color = 50 [set color 48]
end 

to pick-a-fish

 clear-output
    if mouse-inside? [
    if mouse-down? [
      set x round mouse-xcor set y round mouse-ycor
      ask fish with-min [distancexy x y] [set fish-color color]
      ask fish [die]

      create-fish 1                                                                              ;set a new fish like the picked one
       [set color fish-color
        set heading 90
        ifelse heading >= 0 or heading <= 180 [set shape "fish-ll"][set shape "fish-rr"]
        set size 5
        set label round color
     setxy  -5  5
       ]

       create-fish 1                                                                              ;set second new fish like the picked one
       [set color fish-color
        set heading -90
        ifelse heading >= 0 or heading <= 180 [set shape "fish-ll"][set shape "fish-rr"]
        set size 5
        set label round color

     setxy  5  5
       ]
      ;stop
    ]]
end 

to pick-a-fish-1

 clear-output
    if mouse-inside? [
    if mouse-down? [
      set x round mouse-xcor set y round mouse-ycor
      ask fish with-min [distancexy x y] [set fish-color color]
      ask fish [die]

       create-fish 1                                                                              ;set a new fish like the picked one
       [set color fish-color
        set heading 90
        ifelse heading >= 0 or heading <= 180 [set shape "fish-ll"][set shape "fish-rr"]
        set size 5
        set label round color
     setxy  -5  5
       ]

       create-fish 1                                                                              ;set second new fish like the picked one
       [set color fish-color
        set heading -90
        ifelse heading >= 0 or heading <= 180 [set shape "fish-ll"][set shape "fish-rr"]
        set size 5
        set label round color
     setxy  5  5
       ]
      stop
    ]]
end 

to do-plot
 ;set-current-plot "Average Size of Pumpkins"
 ;plot mean [size] of pumpkins

 set-current-plot "Distribution of Fish Color"
 set-plot-x-range 10 50
 histogram [color] of fish
end 

There are 2 versions of this model.

Uploaded by When Description Download
lin xiang almost 3 years ago adjust the interface Download this version
lin xiang over 3 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Goldfish breeding-Artificial selection.png preview Preview for 'Goldfish breeding-Artificial selection' over 3 years ago, by lin xiang Download

This model does not have any ancestors.

This model does not have any descendants.