Presentation is loading. Please wait.

Presentation is loading. Please wait.

Exploring Visual Programming Agentsheets Tutorial II Creating & Reusing Simulation Models Human Computer Virginia Polytechnic Institute and.

Similar presentations


Presentation on theme: "Exploring Visual Programming Agentsheets Tutorial II Creating & Reusing Simulation Models Human Computer Virginia Polytechnic Institute and."— Presentation transcript:

1 Exploring Visual Programming Agentsheets Tutorial II Creating & Reusing Simulation Models Human Computer Interaction @ Virginia Polytechnic Institute and State University

2 Preliminaries The purpose of this document is to introduce you to the concept of creating projects and reusing visual simulations in Agentsheets. It is beneficial to know the basics of using a Macintosh computer and Agentsheets software. In this experiment we want to evaluate the ease of use and reuse of a simulation library to create simulations that can be used by teachers to simulate environments or lab experiments as curricula aids in their classrooms. H Important Note: At times you may not know (or may forget ) how specific functions of Agentsheets work. The last page of this document contains a brief reference guide to specific Agentsheets functions - an Interaction Guide.

3 Reusing the Water Cycle Model n Open the Agentsheets program. n Double click on Agentsheets WaterCycle Worksheet. n Now, this model. H This is just to remind you of the actions that take place in this simulation. n Press after a few minutes of observing the model and quit the Agentsheets program. AgentSheets Tutorial © Virginia Tech Visual Languages Group-Draft

4 Reusing Water Cycle Simulation to Create Food Cycle Simulation H The sample environment that you could simulate is a food cycle. This simulation will involve the interaction of several complex factors. A food cycle includes plants, water, herbivores and carnivores. The plants use water, herbivores eat plants, and carnivores eat herbivores, etc. n On the next sheet draw a simple picture of what you would expect a food chain to look like. Also identify candidate agents for your food chain simulation. (Take 2-5 minutes brainstorming and drawing.) H You can easily accomplish this by adding two new animals, one as predator and one as prey.

5 Food Chain Simulation

6 Creating new agents and Adding behaviors in new Simulation. A simulation in Agentsheets is simply a set of agents that work together to create visual effects. Open Agentsheets program. (it can be found on your desktop) Task 1. Create New Simulation. n Click on File  New Project.. n Name this project as Foodchain_YourInitials. Click on Gallery n Click on File  Save As. n Name this worksheet as Foodchain_Gallery_YourInitials. Task 2. Create New Worksheet. n Click on File  New Worksheet. Task 3. Open the Water Cycle Project to reuse some of the agents. Task 4. Drawing a new agent n Click on Gallery  New Agent and add by entering it in the dialog box. OR Copy an agent Click on Gallery  Grab Any Size and grab the area that you would like to copy. Task 5. Adding behavior to your new agent H To make your food chain an interactive simulation, the agents need to interact with each other. To add actions think about the possible behaviors that your agents can possess. You can create behaviors from scratch or you can drag behaviors from other agents into your behavior palette. n Click on Gallery  Edit Behavior. Refer to interactions guide for more Help with Condition and Action Palettes.. H Think of other interactions that will make your food chain an interesting representation. Have fun trying to get your agents to collaborate in interesting ways.

7 Ozone World. If any Agentsheets or any project is open save and quit now! In the Ozone depletion Cycle a factory emits CFC into the atmosphere and a heterogeneous reaction takes place. This reaction converts the inactive chlorine and bromine reservoirs to more active form. No ozone loss occurs until sunlight initiates the catalytic ozone destruction. n Open the Ozone Depletion Simulation. n Now, this model. n Try adding each agent to the model to investigate it’s functionality. n Press after a few minutes of observing the model. The Smoke_stack agent emits chemicals into the atmosphere. n The Chemicals are emitted by the smoke stack and move up into the atmosphere. They are changed into active BrCl when contacted by the sun. n The Sun agent changes the inactive chemicals into active BrCl. n The BrCl agent moves randomly until it contacts an ozone agent. n The ozone absorbs BrCl and is changed into a weaker ozone agent n Quit Agentsheets when you are finished investigating these agents..

8 Reusing Ozone Depletion World to Create Aquatic World Simulation n The new environment that you could simulate is an Aquatic biosphere. This simulation will involve the interaction of several complex factors. There will be different types of fish that live in this ocean. The larger fish will eat smaller fish, smaller fish will eat plankton and produce bubbles. n On the sheet provided draw a simple picture of what you would expect a Aquatic World Simulation to look like. Also identify candidate agents for your Aquatic World simulation. (Take 2-5 minutes brainstorming and drawing.)

9 Aquatic World Simulation

10 Creating new agents and Adding behaviors in new Simulation. A simulation in Agentsheets is simply a set of agents that work together to create visual effects. Open Agentsheets program. (it can be found on your desktop) Task 1. Create New Simulation. n Click on File  New Project.. n Name this project as AquaticWorld_Gallery_YourInitials. Click on Gallery n Click on File  Save As. n Name this worksheet as AquaticWorld_WS_YourInitials. Task 2. Create New Worksheet. n Click on File  New Worksheet. Task 3. Open the Ozone Depletion Project to reuse some of the agents. Task 4. Drawing a new agent n Click on Gallery  New Agent and add by entering it in the dialog box. OR Copy an agent Click on Gallery  Grab Any Size and grab the area that you would like to copy. Task 5. Adding behavior to your new agent H To make your food chain an interactive simulation, the agents need to interact with each other. To add actions think about the possible behaviors that your agents can possess. You can create behaviors from scratch or you can drag behaviors from other agents into your behavior palette. n Click on Gallery  Edit Behavior. Refer to interactions guide for more Help with Condition and Action Palettes.. Create an interesting simulation!

11 Reusing agents and Adding behaviors in Aquatic World Simulation. Reusing and creating new behavior for your new agent H The previous agents you observed already have behaviors. You may need to look at there behaviors to get started. You can reuse their behavior by just dragging the entire rule that you would like to reuse into your agent’s behavior palette. H Add new behaviors. For example, A large fish in the Aquatic world can eat a small guppy. And the guppy can eat plankton. Refer to interactions guide for more Help. You can open any of the other simulations you view previously for help!!! Just double click on a project on the desktop. H Think of other interactions to make your Aquatic World simulation an interesting representation.

12 Interaction Guide (Worksheet & Gallery Tools) The Cursor Tool allows users to drag agents around within a worksheet. The Pencil Tool allows users to add agents to a worksheet. To use the Pencil Tool an agent in the current gallery must be highlighted. When you then click in a worksheet, an instance of the highlighted agent is placed in the worksheet where you click. The Eraser Tool erases agents in a worksheet. Click on an agent with the Eraser Tool to make it disappear. The Finger Tool,Whack Tool, Link Tool, Unlink Tool have no preset behavior associated with it. It can be programmed by users through the use of Tool Triggers. The Block Draw Tool allows users to place multiple agents in a worksheet. Like the Pencil Tool, the Block Draw Tool requires that an agent in the current gallery be highlighted. The Block Draw Tool creates a bounding box that expands as a user clicks and drags within a worksheet. After the mouse is released, all cells in the block bounded by the bounding box will be filled with instances of the previously highlighted agent. The Fill Tool fills in any closed and empty region of a depiction with the color indicated in the Ink Color box. The Color Sampler Tool looks like an eyedropper and acts like one metaphorically. You can use the Color Sampler to grab colors from pixels anywhere on the screen. Choose the Color Sampler and sample from colors in the Ink Color Palette. You can also grab colors from anywhere on your desktop, even outside of the depiction editor. Attributes can be defined for any AgentSheets agent. Clicking on an agent in a worksheet with the Attribute Query Tool brings up an attribute window showing the agent's attributes and their values. An example attribute window is shown below. Drawing an agent Click on Gallery  New Agent and add a agent by entering it in the dialog box. Double click on agent in the gallery to select it. Use the pencil and color palette to draw your new agent. After creating a new depiction you always want to define a Mask Color for it. Masks are like filters or films of a given color that cover the cell a depiction inhabits. For a transparent background mask Click on Gallery  Mask Color and then select white as the mask color.

13 Interaction Guide (Worksheet & Gallery Tools) The Cursor Tool allows users to drag agents around within a worksheet. The Pencil Tool allows users to add agents to a worksheet. To use the Pencil Tool an agent in the current gallery must be highlighted. When you then click in a worksheet, an instance of the highlighted agent is placed in the worksheet where you click. The Eraser Tool erases agents in a worksheet. Click on an agent with the Eraser Tool to make it disappear. The Finger Tool,Whack Tool, Link Tool, Unlink Tool have no preset behavior associated with it. It can be programmed by users through the use of Tool Triggers. The Block Draw Tool allows users to place multiple agents in a worksheet. Like the Pencil Tool, the Block Draw Tool requires that an agent in the current gallery be highlighted. The Block Draw Tool creates a bounding box that expands as a user clicks and drags within a worksheet. After the mouse is released, all cells in the block bounded by the bounding box will be filled with instances of the previously highlighted agent. The Fill Tool fills in any closed and empty region of a depiction with the color indicated in the Ink Color box. The Color Sampler Tool looks like an eyedropper and acts like one metaphorically. You can use the Color Sampler to grab colors from pixels anywhere on the screen. Choose the Color Sampler and sample from colors in the Ink Color Palette. You can also grab colors from anywhere on your desktop, even outside of the depiction editor. Attributes can be defined for any AgentSheets agent. Clicking on an agent in a worksheet with the Attribute Query Tool brings up an attribute window showing the agent's attributes and their values. An example attribute window is shown below. To create a new depiction Click on Gallery  New Agent. See page 9 for details. n After creating a new depiction you always want to define a Mask Color for it. Masks are like filters or films of a given color that cover the cell a depiction inhabits. For a transparent mask select white. To test one rule at a time you can grab the whole rule and drag it on top agent in the worksheet. If you do this correctly the area around the agent will be highlighted with a red box. You can use to test the simulation, but to incrementally run the simulation one step at a time you should use the step button instead. AgentSheets Tutorial © Virginia Tech Visual Languages Group-Draft

14 Interaction Guide To inspect an agent more closely double click on it and you will see its 32x32-pixel representation. If you cannot edit the agent you are in the wrong view. Select Gallery  Designer Views. Adding Behaviors to an agent n Click on Gallery  Edit Behavior. n This will bring up the window to add behaviors to your agent. Let’s add the behavior that your agent will move in one direction. You must open the Condition and Action Palette and use them in creating your rules. You can change and create agent behaviors with rules. n Rules can be viewed by clicking Tools  Condition Palette and Tools  Action Palette. You program by simply clicking on a rule, then dragging and dropping conditions and actions into the agent’s behavior. To delete a rule or method from an agent’s behavior, simply drag it to the trash. To reuse a set of rules from another agent is a two step process. Step1: Look at the behavior of an agent that you would like to reuse. Select Gallery  Edit Behavior. Step2: Drag the rule set that you would like to reuse into your new agent’s behavior palette. Hint:You must grab the rule on the then section to move the complete rule. To test one rule at a time you can grab the whole rule and drag it on top agent in the worksheet. If you do this correctly the area around the agent will be highlighted with a red box. You can use to test the simulation, but to incrementally run the simulation one step at a time you should use the step button instead.

15 Interaction Guide Behavior Interactions (Condition Commands) The See condition command looks at any of its eight immediate neighbors (at a depth of 1 cell away) and perhaps itself to see if the indicated cell contains the depiction shown in the depiction window of the command. The See a condition command looks at any of its eight immediate neighbors and itself to see if the cell indicated by the direction operator contains an agent of the class specified in the class menu of the command. This command picks out all the depictions of a given agent class. For example, in the Gallery below, all 4 depictions shown are members of the class Auto. The name of an agent class is the same as the name of the base agent depiction of that class. The Next to condition command contains a comparator menu, a number field, and a depiction menu, in that order. These fields combine with the title of the command to form a coherent phrase: "next to greater than 3 north-facing auto(s). The Empty condition command checks to see if its immediate neighbor or itself (as specified by the direction operator) is empty. The % Chance condition command as shown above returns a value of T or True 50% of the time. The % Chance command chooses a random number between 1 and 100 inclusive whenever it is executed. If this number is less than the number indicated in its number field the command returns a value of T or True, indicating the condition was met. If the random number chosen is greater than or equal to the number shown in the command's number field, the command returns a value of NIL or False, indicating the condition was not met. You type in the %chance of the command returning true in the command's number field. The Once every {number} Secs command as shown to the left checks to see if 3 seconds has passed since it was last checked. (Action Commands) The Move action command tells the executing agent to move one cell in the direction indicated by the direction operator. The Move Random On command lets an agent move randomly onto any of its immediate neighbors that show the depiction displayed in the command's depiction window. The Change action command changes the depiction of the agent in the cell indicated by the direction operator to the depiction displayed in the command's depiction window. The New action command makes a new agent in the cell indicated by the direction operator. The Erase action command erases the agent located in the cell indicated by the command's direction operator.


Download ppt "Exploring Visual Programming Agentsheets Tutorial II Creating & Reusing Simulation Models Human Computer Virginia Polytechnic Institute and."

Similar presentations


Ads by Google