### lectures

#### 01-24-2014

posted Jan 23, 2014, 9:48 PM by Samuel Konstantinovich   [ updated Jan 24, 2014, 6:15 AM ]

 Here is the last exam with solutions. I truly apologize but due to the unavoidable time constraints that my absence and health issues caused, I was not able to return it in a timely manner. Please feel free to look over the exam and solutions over the weekend for additional practice. I will post the grades on the Homework server. You are working on the edge detection lab today. Remember to use the patch-at command to easily access the neighbors. Example: Patch-at 1 1   refers to the patch up+left from the current patch. use the dictionary!IMPORTANT Fill out this form:http://goo.gl/jUI3AjLAB:1. Have all patches decide if they should be an edge.THEN (meaning after the 1st operation is completed by EVERY patch)2. Have all patches that are edges change to an edge color. Optionally make the non-edges change white.For part 1: Calculate the vertical and horizontal difference and compare those numbers to a deciding number. You can make the deciding number in the calculation a slider, so you can adjust the sensitivity. For part 2:Edges can be: -Black-Colored based on the original color of the patchor (more challenging)-A shade of grey based on how strong the edge is.

#### 01-21-2014 Color Lab

posted Jan 22, 2014, 7:27 AM by Samuel Konstantinovich   [ updated Jan 22, 2014, 7:27 AM ]

 You are making a image manipulation program that has the following buttons:1.loadImage - loads a predetermined image file2.grayscale - after loading the image, converts it into a black&white picture3.replace - replaces a startColor with an endColor, these are variables from the color choosers.There are two color choosers: startColor endColorTo make a color chooser, add an input , then change the 'type' to color. This will allow you to click any colors you want. Finally:4. Invert - inverts dark/light colors.Every color's 1's digit should be pivoted around the 5. 16 -> 1422 -> 28108-> 10214-> 16Basically if the 1's digit is x, it becomes 10-xWhen a number ends in 0, that is a special case, and you should change it to end in 9.9Here is an example of what EVERYONE should have:Notice the car dark/light was inverted, and the reds were replaced with greens. I could replace any color with any other color if I wish by changing the start/end colors on the color pickers.

#### 00 - Practice Finals

posted Jan 15, 2014, 8:59 AM by Samuel Konstantinovich   [ updated Jan 15, 2014, 8:59 AM ]

 You can view your practice Finals here, along with the reference sheet.http://www.stuycs.org/courses/ml1/racticefinalsI strongly suggest you work on one of them over time, and time yourself on the other one. Solutions won't be posted, but you have unlimited time, and you have a computer to test your answers. Feel free to collaborate and discuss if you are stuck.

#### 01-08-2014 Final Project Specifications

posted Jan 8, 2014, 7:02 AM by Samuel Konstantinovich   [ updated Jan 15, 2014, 8:59 AM ]

#### 01-07-2014

posted Jan 7, 2014, 5:57 AM by Samuel Konstantinovich   [ updated Jan 7, 2014, 5:57 AM ]

 Sliders: accelerationrotationaccelerationbulletdelaybreed [ bullets bullet]breed [ players player]players-own [speed rotatespeed bullettimer]to setup  ca  reset-ticks  ;ask patches [set pcolor red]  create-players 1endto go  ask players [moveplayers]  ask bullets [movebullets]  ;ask patches [set pcolor pcolor + 10]  wait 1 / 30  tickendto movebullets   fd 1  if abs pxcor > max-pxcor - 1 or abs pycor > max-pycor - 1  [ die ]endto moveplayers  fd speed  rt rotatespeed  if bullettimer > 0 [ set bullettimer bullettimer - 1]endto shoot  ask players [     if bullettimer = 0 [      set bullettimer bulletdelay      hatch-bullets 1 [set shape "circle"]]]endto up  ask players [accelerate acceleration ]endto down  ask players [decelerate acceleration ]endto leftkey  ask players [leftbias rotationalacceleration]endto rightkey  ask players [rightbias rotationalacceleration]endto accelerate[n]  set speed speed + nendto decelerate[n]  set speed speed - nendto leftbias[n]  set rotatespeed rotatespeed - nendto rightbias[n]  set rotatespeed rotatespeed + nend

#### 01-02-2014

posted Jan 2, 2014, 5:19 AM by Samuel Konstantinovich   [ updated Jan 2, 2014, 5:19 AM ]

 Goal: You will learn to make breeds behave in different ways depending on their state. It is really important to realize that color and shape do not determine breed. Ack Monsters! Activity There are two breeds: monsters and towers.Monsters need variable to keep track of the state. You can store a string or a number, it doesn't matter.The monsters should be gray, and you can import a "monster" shape from the turtle shape editor. The towers should be white, and "house" shaped. You need sliders for:num_towersnum_monstersrotate_speedtower_radiustower_angleSetup:Create num_towers towers, and num_monsters monsters.All turtles should be size 2 and placed randomly on the world. Every time the program runs go:Patch behavior:-all the patches are black unless they are lit by a tower.Tower behavior: -rotate by rotate_speed degrees-project a cone of light that turns patches yellow.-the cone is tower_angle degrees wide, and tower_radius longMonster behavior:-Monsters on a yellow patch turn "scared" -Monsters on a black patch turn "angry"-Make the monsters have different shapes for angry and scared states. --Angry monsters:---Fade* to color 2.---Wiggle at a speed of .3 and random angle of 30. This makes the monster travel across the screen like a normal wiggle. -Scared monsters: ---Fade* to color 8. ---Wiggle at a speed of .1 and random angle of 360. This makes the monster wiggle in place like they are scared. *Fade that means the monster changes its color by 0.25 towards that color every time go is run so that the color changes slowly.

#### 12-20-2013 Prototype

posted Dec 21, 2013, 8:27 AM by Samuel Konstantinovich   [ updated Dec 22, 2013, 1:24 PM ]

 Attached is the prototype sample.I am asking for a written/pictoral description of your project. There is NO CODE to be written at all.

#### 12-19-2013

posted Dec 19, 2013, 5:42 AM by Samuel Konstantinovich   [ updated Dec 19, 2013, 10:47 AM ]

#### 12-18-2013

posted Dec 18, 2013, 5:22 AM by Samuel Konstantinovich   [ updated Dec 18, 2013, 5:22 AM ]