This page was automatically generated by NetLogo 4.1.3.

powered by NetLogo

view/download model file: patch-sounds.nlogo

WHAT IS IT?

This section could give a general understanding of what the model is trying to show or explain.


HOW IT WORKS

This section could explain what rules the agents use to create the overall behavior of the model.


HOW TO USE IT

This section could explain how to use the model, including a description of each of the items in the interface tab.


THINGS TO NOTICE

This section could give some ideas of things for the user to notice while running the model.


THINGS TO TRY

This section could give some ideas of things for the user to try to do (move sliders, switches, etc.) with the model.


EXTENDING THE MODEL

This section could give some ideas of things to add or change in the procedures tab to make the model more complicated, detailed, accurate, etc.


NETLOGO FEATURES

This section could point out any especially interesting or unusual features of NetLogo that the model makes use of, particularly in the Procedures tab. It might also point out places where workarounds were needed because of missing features.


RELATED MODELS

This section could give the names of models in the NetLogo Models Library or elsewhere which are of related interest.


CREDITS AND REFERENCES

This section could contain a reference to the model's URL on the web if it has one, as well as any other necessary credits or references.


PROCEDURES

;;; patch-sounds.nlogo, cr 13 feb 2012 in 4.1.3 by rha on pro
;;; addition of sounds to patch-patterns

extensions [sound] ;;; from User Manual, Extensions, Sound, must be at the top

to setup
  ca
  crt 1 ;;; to draw a yellow line
    [
      set heading 43
      set color yellow
      pd
    ]
end

to step
  ask turtle 0 
    [ 
      fd 1 
      if ( [ pcolor ] of patch-here ) = green [ test-sound ]
    ]
end

to go
  step
  wait 0.5
end

to test-sound ;;; again, see User Manual
  sound:play-note "TRUMPET" 60 64 0.3 ;;; instument, midi note number, volume, duration
  sound:play-note-later 0.1 "TRUMPET" 64 64 0.2
  sound:play-note-later 0.2 "TRUMPET" 67 64 0.11
end

to patt-1
  ask patches [ if pxcor > 0 [ set pcolor white ]]
end

to patt-2
  ask patches [ if pycor > 0 [ set pcolor yellow ]]
end

to patt-3
  ask patches [ if pxcor + pycor > 0 [ set pcolor red ]]
end

to patt-4
  ask patches [ if pxcor - pycor > 0 [ set pcolor blue ]]
end

to patt-5
  ask patches [ if pxcor mod 2 = 0 [ set pcolor magenta ]]
end

to patt-6
  ask patches [ if pycor mod 2 = 0 [ set pcolor green ]]
end
;;; end of code