Programming an Abstract Painter
Welcome to my Abstract Painter! It's an HTML5 interactive model that allows a user to explore diffusion of color. The interactive simulation is intended to be used by the individual student or learner who is attempting to further understand the concept. The interactive is a NetLogo simulation built in NetTango which allow a user to manipulate an environment with block-based coding and observe the effect of changes upon the simulation. With NetTango, a user can use a custom built, domain specific, blocks-based programming environment to rewrite the simulation to explore how the phenomena work.
WHAT IS IT?
Diffusion Graphics is unlike most other NetLogo models, in that it really doesn't 'model' anything. It simply explores the power behind an interesting patch primitive: 'diffuse'.
It's not intended to closely model real heat, just a number that behaves something like heat -- that slowly spreads itself evenly across a plane.
HOW IT WORKS
In this model, the turtles are "hot spots" -- they set a certain value (a patch variable called 'heat') to the maximum level every time step. Each patch (through the 'diffuse' primitive) then shares its value of 'heat' with its surrounding patches.
Here you can watch what happens as hot-spots interact with each other, as they move around, as their values become negative, or as the 'heat' slowly decays down to nothing. The whole point of the project is to give you an idea how patches interact via the 'diffuse' primitive. (Or maybe just to give you something nice to stare at if you're bored.)
HOW TO USE IT
Two buttons, SETUP and GO, control execution of the model. As in most NetLogo models, the SETUP button will initialize the 'hot-spots' and other variables, preparing the model to be run. The GO button, a forever button, will then run the model.
To initialize the model with NetTango, drag out the blocks setup. Attach the following 4 blocks to it: setup the model, Set brightness, Set Saturation, and Set initial background color. For now keep the default values for all of the blocks, you can tinker with them later to form an intuition of how they affect the model.
Next drag out the go block. Attach the following 4 blocks to it: wander, set speed of circles, diffuse heat, set patch-here heat. You can leave the initial values for each of these.
wander, If you don't include this block the turtles will stay rooted in place.
set speed of circles, if you increase this number, the turtles will start hopping across the screen at a higher rate.
diffuse heat, this is the basis of the model. If the value is set to 100% this means Tell each patch to give equal shares of 100% percent of the value (heat) of patch-variable to its eight neighboring patches. the value is between 0 and 1. Regardless of topology the sum of heat will be conserved across the world. This spreads the heat out, after the circles deposit it.
set patch-here heat, ask each circle to add the value set to the patch its on heat. Increase this value will make the model 'heat up' faster.
THINGS TO NOTICE
Mainly what Diffusion Graphics will show you is how patch-color is diffused in NetTango. The graphical display may evoke fractal imagery, or a topographical landscape. Diffusion Graphics really does bring about a topography of sorts, with the turtles being peaks, and the darkest colors being valleys. The model essentially tries to then smooth out these differences.
Let the model run for a while without the wander block. Watch what happens to the 'terrain'. What do you predict will eventually happen?
This model was built to please. Just play around with the blocks to alter the code and see what works (and what doesn't work, too).
THINGS TO TRY
Try setting set patch-here heat to a very large number. What happens? What does this show you about the RGB color scale?
EXTENDING THE MODEL
Change it so that the setup the model, creat 30 circles would change the number of turtles on the fly, instead of requiring you to hit SETUP.
Currently the position of each turtle is determined randomly at setup. Change the model so that the user may position turtles with the mouse.
The Diffusion Graphics model was designed around the
diffuse is an observer primitive that takes two inputs, a patch variable and a number.
diffuse makes all the patches share that patch variable with their eight neighbors. The second input is a number between 0 and 1.0 determines what fraction of the patch variable is shared. (In this model, the amount shared is controlled by diffuse heat block.) So for example, if I ask the observer to
diffuse heat 50%, the observer tells each patch to give half of
heat to the eight other patches. If a patch had 80 to begin with, then it keeps 40 and gives 5 away to each neighbor. The total value of
heat for all the patches remains constant.
Diffusion (models real heat more closely)
HOW TO CITE
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
- Martin, Kit. NetTango RGB Diffusion Graphics model. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
Please cite the NetLogo software as:
- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.