2017-11-29

posted Nov 28, 2017, 1:14 PM by Konstantinovich Samuel   [ updated Nov 29, 2017, 7:17 AM ]



DO NOW:
-Read the example for the in-radius command, make a small demo to test it out. 
Add a wiggle forever button, and reset the patches to black before you paint the splotches.

-Change the code to change the splotch color if there are any turtles inside of their radius.




HW SUBMISSION:
Final Image Lab
Deadline Thursday 8am
-HW Server slot. Attach a file, leave the comment section blank, unless you have something to say.

I -Include the answers to the questions at the TOP of your code tab as comments. 
II -BEFORE YOU SBUMIT
   1. Change the IMAGE NAMES to:
    cat.jpg
    car.jpg
    crayon.jpg
   2. Change your world size settings as follows:
    max-pxcor 200    
    max-pycor 160
    patch size 2
III - Submit your image lab, nlogo file.





Classwork:

I. Make a copy of your image lab. Remove any buttons/selections that do not work. 
 I assume you have (minimally)
  -Load an image
  -Grayscale
  -Blur
The rest is not critical (for today's lab)

II.  Now you can have your program save the image!

A. Make an export to file button->    
    Look up the export-view command!  
    (Your parents might put your masterpieces on the fridge... or just look at you funny for asking them to do so)

B. You will make a pen tool.
  -Make a color input widget target-color
  -When you click on a patch, it changes to a target-color (color input widget)
    This requires a forever button that calls a paint procedure:
    to paint
      if mouse-down? and mouse-inside?
      [
        ask patch mouse-xcor mouse-ycor
        [set pcolor white]
      ]
   end
  -Modify this paint command to use the target-color.
  -Modify this to paint all patches in a square around the clicked on patch. Try an 11x11 square to start.  (5 in each direction + the clicked on patch)
  -Modify it again, to use the in-radius command to select a group of patches in a radius of 5 around the patch you clicked on.  

-make a slider for the pen radius called paint-radius
When you click on a patch, it asks neighboring patches "in-radius" measured by the slider paint-radius to change color

Try several paint-mode options:  (How do you make different modes in netlogo?)
1. What you should have already: paint a chosen color 
2. Grayscale - Change the patches selected to grayscale.
3. re-colorize patches to their original color (you need to store this somewhere before you gray)
4. blur-pen only blur's the patches in the pen. This should be used on grayscale only.
5. Come up with your own ideas!





Comments