2015-01-20 Practice Final

posted Jan 20, 2015, 5:01 AM by Samuel Konstantinovich   [ updated Jan 20, 2015, 5:31 AM ]

You can view the PDF here:

Please fill this out really quickly, one per final project group: (regarding project presentations)

2015-01-08 Projects

posted Jan 8, 2015, 4:56 AM by Samuel Konstantinovich   [ updated Jan 13, 2015, 5:15 AM ]

Final Project Logistical Requirements:

1. You must be careful to constantly combine your code throughout the time you work on your project. In order to enforce this, and make sure you are not procrastinating:
There will be homework server slots for your projects for the following days:
Jan 9 (Fri)
Jan 14 (Wed)
Jan 16 (Fri)
Jan 20 (Tuesday) Final Due date!

2. You must submit your code in a functional state. If the program crashes, revert your recent changes. It is OK to have bugs, but it is not OK to be completely broken. 

3. You must update your info tab every day with the changes you make, and who made them.


## Features and Directions
  1. Click Setup
  2. Click Setup2
  3. Click Go
  4. Play the game

  * Awesome pathfinding, the turtles avoid ... stuff.
  * Turtle AI is smarter than most dead animals.

## 01-07-2014

### Junhao: 
  * Created a turtle that can be controlled by the wasd buttons. 
  * Added strafing.

### L. Jenkins: 
  * Created the background patch arrangement. 
  * Created the function to check if a patch is passable or not based on the colors.

## 01-08-2014

  * Added shooting
  * Added targets.
  * Wrote functions for collisions 

###L. Jenkins: 
  * Created some shapes to make it look nice
  * Fixed bug in moving near edges

2014-12-23 last day!

posted Dec 23, 2014, 5:01 AM by Samuel Konstantinovich   [ updated Jan 4, 2015, 9:27 PM ]

Get on piazza. Reply to the posts right away. 
More posts will be added as the class goes on. 
I expect prompt responses.


posted Dec 21, 2014, 9:18 PM by Samuel Konstantinovich   [ updated Dec 23, 2014, 5:00 AM ]

Today you have the period to: 
-brainstorm project ideas Ideas in groups 
-find a partner in class

Note that and more than one group can work on similar projects (provided they work independently)

Due to my illness I am shifting things back a little bit.  
Your prototype is due Wed Jan 7th. after you come back from break. Since you have today to work on brainstorming.

I just want a written + pictorial description of your project idea. 

A sample prototype is included:  

2014-12-19 ImageLab

posted Dec 19, 2014, 4:57 AM by Samuel Konstantinovich   [ updated Dec 19, 2014, 4:57 AM ]

You are making a image manipulation program that has the following buttons:

1. loadImage - loads a predetermined image file

2. grayscale - after loading the image, converts it into a black&white picture

3. Invert - inverts dark/light colors.

4.replace - replaces a startColor with an endColor, these are variables from the color choosers.

There are two color choosers:
To make a color chooser, add an input , then change the 'type' to color. This will allow you to click any colors you want. 

2014-12-15 Zombies Part II

posted Dec 15, 2014, 5:36 AM by Samuel Konstantinovich   [ updated Dec 15, 2014, 5:36 AM ]

Humans vs. Zombies part II, revenge of the ... zombies?

Get a copy of the working lab from your partner.

If your partner doesn't have a working lab the first thing you do is fix it with them.


New Zombie Behavior:

1. Zombie Shape
-You must use ticks now. Setup needs reset-ticks. Go needs tick.
-Use on-ticks instead of continuous to smooth your animation.

-Zombies should change their shape and color every 2 ticks. 
-Zombies should change their shape between two "zombie" shapes. 

2. Zombie Vision is limited to a cone
-Zombies now search for humans using a cone of vision, this has several consequences:
-Zombies have not only a vision radius, but they need a vision angle as well, set it to 120 to test, but later make a slider.
-Zombies only detect humans in their cone of vision

3. Zombie Vision should be displayed on the screen. 
-New interface element:  Make a toggle switch viewableCones. This will be true or false depending if the switch is on or off.
-When viewableCones is toggled on: Make the zombies change the color of the patches in their vision cone to yellow. Patches that leave the vision cone should revert to black.

4. Make a safe haven for humans:
-Make your world maxpxcor 32, and maxpycor 32. 
-Make an  11x11 square of blue patches in the middle of the board. Zombies cannot step on these patches, if they do, they must immediately move backwards.
-These blue patches should not be changed to yellow by the zombie vision cones. 

2014-12-12 LabZombies

posted Dec 12, 2014, 5:24 AM by Samuel Konstantinovich   [ updated Dec 12, 2014, 11:51 AM ]

Lab: Zombies vs Humans

1. Overview:

-You will work on this today, and complete it at home.

-You will be given a partner for this project on Monday. 

-You will be required to swap your file with your partner, and add new features to your partner's code. This means you should be writing things in a readable and clear way (no crazy variable names or poor spacing/newlines)

2. Zombie Behavior:

-When there is a human in a radius of zombie_vision_radius (make a slider), the Zombies chase after the closest human at a speed of 0.5. Otherwise they shamble. Shamble is a slow wiggle (move forward at 0.1, and modify the angle randomly +/- 20 degrees). 

-When a zombie catches a person (the person is on the same patch as the zombie) the person dies, and a new zombie is created it should look like the other zombies. 

3a. Human Behavior

-Humans normally wiggle at a speed of 0.2, angle at +/- 20 randomly.

-When a person wiggles, they also they gain 1 stamina (but no more than max_stamina.

3b. Human Behavior when they see a zombie

-When one or more zombies are closer than human_vision_radius (make a slider) units away, they try to run from the zombies.

 -When a person is running they check their stamina:

---When there is 1 or more stamina, the person move away from the nearest zombie at speed 1.0 

---When there is 0 stamina, the person moves away from the nearest zombie at speed 0.1 (do not recover stamina here)

---People start with maximum_stamina (make a slider). Their stamina decreases by 1 every time they successfully run.

4. Miscellaneous:

- Make Sliders for starting_zombies ( 1-20), starting_humans (1-100)

- Make Slider for maximum_stamina (20-100)

- Make Sliders for zombie_vision_radius, and human_vision_radius

- Make Monitors for : the number of zombies and the number of humans

- Your project should run at an appropriate speed.

- Zombies are all different shades green, humans are all orange shades. (Don't make them too dark or bright)

- OPTIONALLY AT HOME: make different custom shapes (“zombie” , "uglyZombie" etc) in the shapes editor (don't spend too much time on this) Make sure you duplicate the “person” shape instead of just editing it, or you will lose the person shape.

You will need: 






for example:

To see if there are any things in a 5 unit radius

if any? things in-radius 5[

   do stuff


To face a specific thing

face thing

To face away, turn around after facing it.

To find the closest thing and turn it red

if any? things


ask min-one-of things [distance myself]

  [ set color red ]


2014-12-11 Lab

posted Dec 11, 2014, 4:53 AM by Samuel Konstantinovich   [ updated Dec 12, 2014, 4:53 AM ]

Goal: Cellular Automata

HW: Complete conways game of life

Regarding yesterday's lab:

If you think about your code using big ideas, and write functions to do those ideas, you will meet with more success.

Most of your cellular automata can be written in the following way using 'big ideas':

to go
  ask patches
  [   pickNextColor   ]
  ask patches
  [   changeColor   ]

OR in this specific case, since color is dependent on neighbor counts:

to go
  ask patches
  [   countNeighbors   ]
  ask patches
  [   changeColor   ]

PickColor will be different for different automata, but the separation of deciding what you want to be, and the changing into that new state must be clear. 

2014-12-10 Voting Lab

posted Dec 10, 2014, 4:47 AM by Samuel Konstantinovich   [ updated Dec 10, 2014, 5:11 AM ]

Goal: Patches can vote

Phase I
Assign each patch a pcolor of red or blue randomly.

1. Ask every patch to look at how many red/blue neighbors they have. They need to remember this number for later.
2. Ask every patch to change their color if there is a majority ( simple majority, 5 or more of one color.)
You must make sure step 1 completes before you start step 2, or you will count the UPDATED colors of neighbors, which is not the desired effect.

Phase II
Change the setup: 
Make the patches red, blue, green randomly.

Change the Go: 
If there is a majority of any one color ( more than 4 red, more than 4 blue, or more than 4 green ) then change to that color.

2014-12-08 Lab

posted Dec 8, 2014, 6:33 AM by Samuel Konstantinovich   [ updated Dec 8, 2014, 6:33 AM ]

Labs MUST be finished at home if not completed in class. 

Goal: Patches

1. Make a setup function that changes the patch color of the world based on their locations. The top third of the world should be white, the middle third should be red, and the bottom third should be black. (3 horizontal stripes of color)
hint: How big is the default world?

2. Make a go command that makes each individual patch have a chance to change to yellow.
white patches have a 1% chance
red: 5% chance
black: 10% chance
(do not make this a forever button)

3. If you change your max-pycor then the code you wrote may not work. How can you change your code to work with any world size? (with the origin in the middle)
- Come up with a formula to help you apply your setup to any size world.

4. Change your world size to test, make your patches smaller to compensate for larger world sizes.

1-10 of 55