Due: Tuesday 1/14 10:00am

a37_sunset

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 the reset 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, set start_color to pcolor.

reset

  • A patch should changes its pcolor to its start_color value.
  • If done correctly, reset will be much faster to run than setup

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 either black or white
  • black patches should be ones that were on the darker side of the color spectrum while white 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 is 40, all patches should have pcolor 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.