Diffuse Off Edges Example

Diffuse Off Edges Example preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

(This model has yet to be categorized with any tags)
Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 320 times • Downloaded 48 times • Run 0 times
Download the 'Diffuse Off Edges Example' 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

Click to Run Model

patches-own
[
  value          ;; this is the quantity we will be diffusing
]

globals
[
  edge-patches   ;; border patches where value should remain 0
  main-patches   ;; patches not on the border
]

to setup
  clear-all
  ;; we assume that vertical and horizontal wrapping are both
  ;; off, so edge and corner patches have fewer than 8 neighbors
  set edge-patches patches with [count neighbors != 8]
  set main-patches patches with [count neighbors = 8]
  ;; create some random numbers to diffuse
  ask main-patches [ set value random-float 100 ]
  recolor
  reset-ticks
end 

to recolor
  ask patches
    [ set pcolor scale-color blue value 0 100 ]
end 

to go
  ;; first, do a normal diffuse
  diffuse value 1
  ;; now remove any of the value which has reached the edges
  ;; of the world
  ask edge-patches [ set value 0 ]
  recolor
  tick
end 


; Public Domain:
; To the extent possible under law, Uri Wilensky has waived all
; copyright and related or neighboring rights to this model.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Diffuse Off Edges Example Download this version
Uri Wilensky over 14 years ago Diffuse Off Edges Example Download this version

Attached files

File Type Description Last updated
Diffuse Off Edges Example.png preview Preview for 'Diffuse Off Edges Example' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.