Due: Tuesday 1/14 10:00am
Submission name: work37.nlogo
Recreate the NetLogo program found here: http://homer.stuy.edu/~dw/netlogo/img/images_obf.html. Important notes about the web version, all related to the fact that it is slower than regular NetLogo:
- The world size is very small (320x240).
- Most of the procedures will run slowly, do not spam the buttons. Wait until you see a result to try again.
- The
setup
procedure is particularly slow, you will need to us it once, but after that, use thereset
button instead.
World State:
We want 1 patch to be equal to 1 pixel to do that:
- Set the origin to the bottom-left corner.
- Set the size to 640 x 480
- Set the patch size to 1
Patch properties
Give patches 2 properties to be used in your procedures:
start_color
next_color
Procedures
setup
- Clear the world
- Load an image as pcolors using
import-pcolors
. You can use the image at the top of this assignment, or one of your choosing. For best results, pick an image with a resolution of 640x480 pixels. - After all the patches have loaded their
pcolor
values, setstart_color
topcolor
.
reset
- A patch should changes its
pcolor
to itsstart_color
value. - If done correctly,
reset
will be much faster to run thansetup
grayscale
- Change a patches
pcolor
to a value in the black-white range [0, 10). - Think about how NetLogo arranges colors, this can be done in one or two lines of code.
black_white
- Change a patches
pcolor
to eitherblack
orwhite
black
patches should be ones that were on the darker side of the color spectrum whilewhite
patches should be the others.
color_shift
- Give every patch a color within a range defined by the
base_color
slider. - e.g. if
base_color
is40
, all patches should havepcolor
values in the range [40, 50) grayscale
can be a useful starting point.
rainbow
- Split the image into 7 color bands, coloring them similarly to
color_shift
. - Use these NetLogo color values:
red, orange, yellow, green, sky, blue, violet
scroll
- When run once, every patch should become the
pcolor
of the patch on its left. - When run as a forever button, it should look like the image scrolls across the screen.
next_color
should be used here.