SUCCEED

   

Forensic Science
Shodor > SUCCEED > Curriculum > Workshops > Forensic Science

Creating a Scent Model

Objective: Students will learn about tracking items through computer modeling.

Materials: Each student will need

  • A computer with AgentSheets
  • Three images saved on the desktop. (The students can create their own images as well.) Images can be downloaded using the following links:

Making a Hound sit in the grass

  1. Create new project and save it as "YournameCookie"
  2. Define Agent Size: click ok
  3. Gallery: click new agent, name it: background
  4. Click on background and change the image: click file and import image: pick background.gif then click done
  5. Open up a new worksheet. Title the worksheet anything you want. It should be blank. Cover the entire worksheet with background. Click on the background image and then go to the worksheet and click on any part of it. You can do this for each block, but that is tedious. It would be better to take the rectangle shape and cover the whole worksheet in one motion.
  6. Place one hound in the bottom left-hand corner.

Ask prompting questions to start a discussion, such as:

  • What is going to happen? Why?
  • Let's press play and see what happens. Why did that happen?
  • What do we need to do?

Make a Hound run in the grass

Have the students determine what needs to happen to make the Hound run around in the grass. Ask questions to start a discussion such as:

  • Now that we have two agents, we need to give them behaviors. What kind of behaviors does grass have if it is a background? It is just there and the hound runs around in the grass.
  • What kinds of things affect what a dog does? Are any of those things in our model?

To have the Hound run randomly:

  1. Double click on the hound in the gallery so his behavior window shows up. Then, click on the action gallery and search for a basic motion called "move random on".
  2. Drag that into the "then" section of the behavior. Right now it has an image of the hound, but we want the hound to move randomly on the grass. Click on the hound image and it should bring up the grass as well.
  • Now what should happen?
  • What did happen?
  • What do we want to do next in order to model our situation?

Adding in the cookies

  1. Click new agent, name it: cookie
  2. Click on cookie and import image: pick cookie.gif then click done.
  3. Add 5 or 6 cookies onto our worksheet.
  4. Double click on cookie: behavior window pops up.
  5. Define what it is that we are doing in the first open box: Each cookie has 1000 cookie_scent.
  6. Open up the actions gallery and scroll down until we find an action that would define our cookie. It is what we call an "attribute". Use: Set value to value[left] + 1.
  7. Change that to be similar to our problem: Set cookie_scent to 1000.
Ask the students what they think will happen:
  • Now what will happen when we press play?
  • Will the dog be attracted to the cookies?
  • What happened? Why?

Setting the Hound on the cookies

  1. Look at the background and give it a new behavior.
    • What kind of behavior do you think we want it to have now?
    • Does the area around a cookie have a particular scent? How strong of a scent?
    • What if you were very far away from the cookie?
  2. The grass is going to have the "attribute" of a cookie_scent. We want it to have this for a description: The human_scent and cookie_scent of a square of grass is the average of the scents of its neighboring squares(above, below, right, and left). This occurs while running.
  3. Go down to attributes in the action gallery again and select the same attribute as the cookie. Set cookie_scent to (cookie_scent[up] + cookie_scent[down] + cookie_scent[left] + cookie_scent[right])/4. This gives the grass the attribute of the average of its surrounding agents. If a blade of grass is near a cookie, the scent will be stronger.
  4. Define this action while running: If there is very little cookie scent the hound will move randomly on the grass. Otherwise the hound will use the method hunt_cookie to choose where to go.
  5. Start with random movement since we already have the "then" statement for it. Take the "is value = 0" attribute and put it in the if section. Change the value to the average: (cookie_scent[up] + cookie_scent[right] + cookie_scent[down] + cookie_scent[left]) / 4. Change the equal sign to a less than sign and then the value should be 4.
  6. Go up to basic and find the condition: once every 1.0 secs. Let's make it 0.4 secs just to speed things up. These are the conditions for the hound to move randomly. Make sure that you have the hound moving randomly on "background".
  7. We want to make another rule while running for when it isn't random. For the if, let's put once every 0.15 secs. And the Then needs to be Make hunt_cookie.
  8. Add a new method to explain what the hound does while he is hunting the cookie. Change the first box to say "If hound is directly next to a cookie, the hound will operate according to devour_cookie. Otherwise the hound will move in the direction where the cookie_scent is strongest."
  9. If the hound is next to a cookie we want it to eat the cookie (devour_cookie). Find the condition that says next to = 0. Change that to greater than/equal 1 for the IF statement. The THEN statement should read "make devour_cookie".
  10. The next IF statement should be if the hound isn't next to the cookie, how it should move. If cookie_scent[left] is greater than/equal to cookie_scent[right], [up], [down], respectively it moves left. Do this for right, up, and down.
  11. Create a new method. Label it devour_cookie. Define it as: When the hound sees a cookie it will erase(eat) the cookie.
  12. IF statements should be see (the direction) (the agent). Click on the direction to change it. Same with the agent. The THEN statement should be erase (that same direction).