Continuation of John Murphy’s RePast Tutorial Steps 10-18 Charlie Gieseler 8-9-04.

Slides:



Advertisements
Similar presentations
Indistar® Leadership Team Meetings. Where can we plan a meeting? Choose ‘Plan Your Meeting’ from the main menu screen Click on Meeting Agenda Setup.
Advertisements

CMSC 341 Building Java GUIs. 09/26/2007 CMSC 341 GUI 2 Why Java GUI Development? Course is about Data Structures, not GUIs. We are giving you the opportunity.
Section 1 REGISTERING Yourself. Soldier Getting Started Guide ARNG Leave Tracking System
Variable types We have already encountered the idea of a variable type. It is also possible to think about variables in terms of their kind, namely: 1)
Chapter 3, Section 2 Checking Accounts.
Java Programming, 3e Concepts and Techniques Chapter 5 Arrays, Loops, and Layout Managers Using External Classes.
Evan Korth New York University Computer Science I Classes and Objects Professor: Evan Korth New York University.
Object Oriented Programming.  OOP Basic Principles  C++ Classes  September 2004  John Edgar 22.
16/22/2015 2:54 PM6/22/2015 2:54 PM6/22/2015 2:54 PMObject-Oriented Development Concept originated with simulating objects and their interactions. Adapted.
Web Page Development Identify elements of a Web Page Start Notepad
Arrays, Loops weeks 4-6 (change from syllabus for week 6) Chapter 4.
There is a certain way that an HTML file should be set up. The HTML section declares a beginning and an ending. Within the HTML, there should be a HEAD.
 Pearson Education, Inc. All rights reserved Arrays.
Inventory Throughout this slide show there will be hyperlinks (highlighted in blue) follow the hyperlinks to navigate to the specified Topic or Figure.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Microsoft Visual Basic 2008 CHAPTER ELEVEN Multiple Classes and Inheritance.
JavaScript Events and Event Handlers 1 An event is an action that occurs within a Web browser or Web document. An event handler is a statement that tells.
1 CSC 221: Computer Programming I Fall 2004 Objects and classes: a first pass  software objects, classes, object-oriented design  BlueJ IDE, compilation.
A First Program Using C#
XP New Perspectives on Microsoft Office Access 2003 Tutorial 11 1 Microsoft Office Access 2003 Tutorial 11 – Using and Writing Visual Basic for Applications.
Tutorial 11 Using and Writing Visual Basic for Applications Code
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
Microsoft Visual Basic 2008 CHAPTER ELEVEN Multiple Classes and Inheritance.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 1B Introduction (Tutorial)
Greenfoot. Getting Started Open the Greenfoot download site: Select Greenfoot
Java Software Solutions Lewis and Loftus Chapter 10 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Graphical User Interfaces --
The CarryDrop Model (Steps 19-24) : A RePast Tutorial by John Murphy by Junjie Sun 8/16/2004 Department of Economics Iowa State University.
Author: Loh Jianxiong Christopher Editors: Chua Jie Sheng, Li Mengran, Peh Shao Hong, Oo Theong Siang.
Internet and Distributed Representation of Agent Based Model by- Manish Sharma.
Introduction to Computational Modeling of Social Systems Prof. Lars-Erik Cederman Center for Comparative and International Studies (CIS) Seilergraben 49,
1 Building the CarryDrop Simulation in JBuilderX By Deddy Koesrindartoto 08/16/2004.
Creating and running a Java program. Eclipse Interactive Development Environment (IDE)  Eclipse is an Interactive Development Environment (IDE) for Java.
OOP in Java : © W. Milner 2005 : Slide 1 Java and OOP Part 2 – Classes and objects.
Installing Repast in the Eclipse IDE Charlie Gieseler 6/28/04.
1 Creating Windows GUIs with Visual Studio. 2 Creating the Project New Project Visual C++ Projects Windows Forms Application Give the Project a Name and.
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
1 Setting Up for RePast, and Running a Repast Stand Alone Example 06/21/2004 by Deddy Koesrindartoto Department of Economics Iowa State University.
Tool Install How to download & install Java 6 & Eclipse updated version based on Dr. G. L. Ray’s slides.
Microsoft Visual Basic 2008 CHAPTER ELEVEN Multiple Classes and Inheritance.
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface Creating a Multiple-Form Interface.
Processing Workshop. What is processing? “Processing is an open source programming language and environment for people who want to program images, animation,
Microsoft Visual Basic 2012 CHAPTER ELEVEN Multiple Classes and Inheritance.
Class Builder Tutorial Presented By- Amit Singh & Sylendra Prasad.
Chapter 5 Introduction to Defining Classes
Computer Science I Recap: variables & functions. Images. Pseudo-random processing.
Liang, Introduction to C++ Programming, (c) 2007 Pearson Education, Inc. All rights reserved X 1 Chapter Array Basics.
Tutorial 7 Creating Animations. XP Objectives Learn about animation Create a timeline Add AP divs and graphics to a timeline Move and resize animation.
Georgia Institute of Technology More on Creating Classes part 1 Barb Ericson Georgia Institute of Technology Oct 2005.
Building the CarryDrop simulation in Eclipse Creating a new project with existing code from John Murphy’s RePast tutorial.
Aquarium Lab Series Developed by Alyce BradyAlyce Brady of Kalamazoo CollegeKalamazoo College.
Special Methods in Java. Mathematical methods The Math library is extensive, has many methods that you can call to aid you in your programming. Math.pow(double.
Computer Science I Animations. Bouncing ball. The if statement. Classwork/homework: bouncing something. Compress and upload work to Moodle.
Creating a RePast Model Introduction, (Sim)Model Object, CarryDrop.
 2005 Pearson Education, Inc. All rights reserved Arrays.
PaintPictureBoxDemo Refers to the PaintPictureBoxDemo Visual Basic Program Included With The Lecture.
Chapter 9 Introduction to Arrays Fundamentals of Java.
1 Sections 5.1 – 5.2 Digital Image Processing Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Georgia Institute of Technology More on Creating Classes Barb Ericson Georgia Institute of Technology June 2006.
Chapter 5 Introduction to Defining Classes Fundamentals of Java.
The CarryDrop Model (Steps 4-9) : A RePast Tutorial by John Murphy by Junjie Sun 8/2/2004 Department of Economics Iowa State University.
CSC 205 Programming II Lecture 5 AWT - I.
Getting started with the Arxterra software and 3DoT Firmware
Multiple Classes and Inheritance
Chap 7. Building Java Graphical User Interfaces
Graphical User Interfaces -- Introduction
Array Lists Chapter 6 Section 6.1 to 6.3
Tutorial 19 - Microwave Oven Application Building Your Own Classes and Objects Outline Test-Driving the Microwave Oven Application Designing.
Object Oriented Programming in java
Java Programming with BlueJ Objectives
Presentation transcript:

Continuation of John Murphy’s RePast Tutorial Steps Charlie Gieseler

Review from last time Start to fill out the CarryDropSpace class Start to fill out the CarryDropSpace class Constructor to build a space of a given size Constructor to build a space of a given size Added CarryDropSpace variable to the model Added CarryDropSpace variable to the model Added preparation line in Setup() Added preparation line in Setup() Added creation line in buildModel() Added creation line in buildModel()

Step 10 - Initializing the Space Object We need to disperse money in the space. Define spreadMoney() method in CarryDropSpace. Call spreadMoney() while building the model in CarryDropModel.

Step 11 - Extracting reusuable code We have now have code to check how much money is at a location. We have now have code to check how much money is at a location. This could be useful outside of spreadMoney() or CarryDropSpace This could be useful outside of spreadMoney() or CarryDropSpace Define a new method: getMoney(int x, int y) Define a new method: getMoney(int x, int y)

Tapping RePast’s visualization resources We are now at the point we can start to visualize our model We are now at the point we can start to visualize our model Initial visualization objectives Initial visualization objectives See our 2-D grid space See our 2-D grid space White background White background Visible money, which squares have cash Visible money, which squares have cash Amount of cash indicated by color shade Amount of cash indicated by color shade RePast provides classes to build displays RePast provides classes to build displays DisplaySurface – basically a window ColorMap – links numerical values to colors Value2DDisplay – links value sources from the model to colors according to the color map. Displays colors for each source in window when added to a DisplaySurface.

Step 12 – Using the DisplaySurface Import the class Import the class Create the variable Create the variable “Tear down” “Tear down” Instantiate Instantiate Pass in the model Pass in the model Give it a name Give it a name Register the object Register the object

Step 13 – A splash of color Import the needed classes Color is a standard Java class to represent color values Will need access to the 2D grid of values Add access method to CarryDropSpace

Step 13 cont. Create and initialize ColorMap in CarryDropModel - Use loop to map values to shades of red - Value of 0 (default) maps to white Create Value2DDisplay object, displayMoney, using in 2D grid of values and our ColorMap Add displayMoney to the window, displaySurf. displayMoney will tell the display window what color (white or a shade of red) to put at each location in a 2D grid. It does this according to what value cdSpace currently has for each location in its grid.

Step 14 – Generating the Display Simply add this line to in the begin() method in CarryDropModel Now run compile everything and run CarryDropModel in your favorite IDE. When RePast starts, hit the “Initialize” button.

Step 15 – The Agents Start with 4 attributes Start with 4 attributes Money Money X position X position Y position Y position Lifespan (stepsToLive) Lifespan (stepsToLive)

Step 15 cont. – Modifying CarryDropModel for Agents Bounding Agent lifespans Define default values Define parameter variables Add parameter names to allow users to edit values through RePast Add access methods for parameter vriables

Step 16 – Adding Agents to the model Make a container to for all the Agents: ArrayList Make a container to for all the Agents: ArrayList Initialize the agentList in setup() Initialize the agentList in setup()

Step 16 cont. Define new method in CarryDropModel for adding Agents to the list Define new method in CarryDropModel for adding Agents to the list In buildModel(), make the desired number of calls to addNewAgent() to add Agents to the list In buildModel(), make the desired number of calls to addNewAgent() to add Agents to the list

Step 17 – A Space for Agents Want to add agents to CarryDropSpace. Want to add agents to CarryDropSpace. Space containing agents will be an Object2DGrid like moneySpace. Space containing agents will be an Object2DGrid like moneySpace. We need: We need: Agents to track their locationAgents to track their location Some way to tell if a cell is occupied Some way to tell if a cell is occupied Some way to add an Agent to the spaceSome way to add an Agent to the space

Step 17 cont. IsCellOccupied() checks if an Agent is already in a given cell in the agentSpace object. IsCellOccupied() checks if an Agent is already in a given cell in the agentSpace object. addAgent() attempts to add an Agent in a random cell. addAgent() attempts to add an Agent in a random cell.

Step 18 – Adding Agents to the space Add a line in addNewAgent() in the CarryDropModel to add a agent to the CarryDropSpace. Add a line in addNewAgent() in the CarryDropModel to add a agent to the CarryDropSpace. Now whenever the model adds a new agent to the list, it will also attempt to add it to the simulation space. Now whenever the model adds a new agent to the list, it will also attempt to add it to the simulation space.