AP ® Marine Biology Simulation Case Study Alyce Brady Kalamazoo College.

Slides:



Advertisements
Similar presentations
Recursion Chapter 14. Overview Base case and general case of recursion. A recursion is a method that calls itself. That simplifies the problem. The simpler.
Advertisements

CS 206 Introduction to Computer Science II 09 / 05 / 2008 Instructor: Michael Eckmann.
Stanford University CS243 Winter 2006 Wei Li 1 Register Allocation.
Generics and the ArrayList Class
CompSci 427jd.1 Javadoc. CompSci 427jd.2 Javadoc The Plan  What is Javadoc?  Writing Javadoc comments  Using the Javadoc tool  Practice.
Chapter 10 Introduction to Arrays
Case, Arrays, and Structures. Summary Slide  Case Structure –Select Case - Numeric Value Example 1 –Select Case - String Value Example  Arrays –Declaring.
Chapter 16 Dynamic HTML and Animation The Web Warrior Guide to Web Design Technologies.
Using ArrayList. Lecture Objectives To understand the foundations behind the ArrayList class Explore some of the methods of the ArrayList class.
Slides prepared by Rose Williams, Binghamton University Chapter 14 Generics and the ArrayList Class.
Chapter 14 Generics and the ArrayList Class Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
Alice in Action with Java
CS 106 Introduction to Computer Science I 04 / 28 / 2010 Instructor: Michael Eckmann.
Copyright 2010 by Pearson Education 1 Assignment 11: Critters.
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
Using Data Active Server Pages Objectives In this chapter, you will: Learn about variables and constants Explore application and session variables Learn.
AP ® Marine Biology Simulation Case Study Alyce Brady Kalamazoo College.
ACM/JETT Workshop - August 4-5, Marine Biology Case Study (MBCS) A Discussion.
AP ® Marine Biology Simulation Case Study Alyce Brady Kalamazoo College.
Marine Biology Simulation Case Study Alyce Brady Kalamazoo College.
Chapter 6 Class Inheritance F Superclasses and Subclasses F Keywords: super F Overriding methods F The Object Class F Modifiers: protected, final and abstract.
1 iSee Player Tutorial Using the Forest Biomass Accumulation Model as an Example ( Tutorial Developed by: (
Georgia Institute of Technology Extending the Case Study Barbara Ericson January 2005.
Spreadsheet-Based Decision Support Systems Chapter 22:
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Events Chapter 7 Part 2. While a Key is Pressed Event Specialized event An event occurs when you press a key and continues until you take your finger.
REVIEW On Friday we explored Client-Server Applications with Sockets. Servers must create a ServerSocket object on a specific Port #. They then can wait.
111 © 2002, Cisco Systems, Inc. All rights reserved.
23-Oct-15 Abstract Data Types. 2 Data types A data type is characterized by: a set of values a data representation, which is common to all these values,
Programming Principles Chapter 1. Objectives Discuss the program design process. Introduce the Game of Life. Discuss object oriented design. – Information.
Chapter 14 Generics and the ArrayList Class Slides prepared by Rose Williams, Binghamton University Copyright © 2008 Pearson Addison-Wesley. All rights.
Marine Biology Simulation Part II: Assignment, Milestone 1 Dung “Zung” Nguyen Mathias Ricken Stephen Wong TeachJava 2004! June 25, 2004.
Javadoc Comments.  Java API has a documentation tool called javadoc  The javadoc tool is used on the source code embedded with javadoc-style comments.
CS 106 Introduction to Computer Science I 04 / 23 / 2010 Instructor: Michael Eckmann.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Nifty Assignments: Marine Biology Simulation OOPSLA ‘04 Educators’ Symposium October 25, 2004 Eric Cheng Mathias Ricken Dung “Zung” Nguyen Stephen Wong.
AP Computer Science edition Review 1 ArrayListsWhile loopsString MethodsMethodsErrors
Chapter Three The UNIX Editors.
Georgia Institute of Technology Simulations Barb Ericson Jan 2005.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Teaching with the AP ® Marine Biology Simulation Case Study Materials mostly from: Alyce Brady(Case Study Author) Kathy Larson(Case Study Teachers' Guide.
Teaching with the AP ® Marine Biology Simulation Case Study Materials mostly from: Alyce Brady(Case Study Author) Kathy Larson(Case Study Teachers' Guide.
Cellular Automata Introduction  Cellular Automata originally devised in the late 1940s by Stan Ulam (a mathematician) and John von Neumann.  Originally.
M1G Introduction to Programming 2 5. Completing the program.
Lesson 6 – Libraries & APIs Libraries & APIs. Objective: We will explore how to take advantage of the huge number of pre-made classes provided with Java.
CreatingClasses-SlideShow-part41 Creating Classes part 4 Barb Ericson Georgia Institute of Technology Dec 2009.
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
Review for test! Alice Chapter 1&2 Test is tomorrow! - March 26 th March 25th.
CS 106 Introduction to Computer Science I 04 / 18 / 2008 Instructor: Michael Eckmann.
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
The GridWorld Case Study Program Section 1 - Overview of the Class Hierarchies Section 2 - The Actor Class Section 3 - The Rock and Flower Classes Section.
Teach.NET Workshop Series Track 4: AP Computer Science with.NET and J#
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
CompSci 427jd.1 Javadoc. CompSci 427jd.2 Javadoc The Plan  What is Javadoc?  Writing Javadoc comments  Using the Javadoc tool  Practice.
Session 7 Introduction to Inheritance. Accumulator Example a simple calculator app classes needed: –AdderApp - contains main –AddingFrame - GUI –CloseableFrame.
Aquarium Lab Series Developed by Alyce BradyAlyce Brady of Kalamazoo CollegeKalamazoo College.
Object Orientated Programming in Perl Simulated Models of Termites.
Lists List Implementations. 2 Linked List Review Recall from CMSC 201 –“A linked list is a linear collection of self- referential structures, called nodes,
Teach.NET Workshop Series Track 4: AP Computer Science with.NET and J#
Teaching with the AP® Marine Biology Simulation Case Study
AP Case Study Overview Barbara Ericson Jan 2005
JavaDoc CECS277 Mimi Opkins.
Java Programming: Guided Learning with Early Objects
Interfaces and Inheritance
Graph Paper Programming
Graph Paper Programming
Building a Game in Scratch
Marine Biology Simulation Part II: Assignment, Milestone 1
creating a ecosystems model in net logo
Magpie/Chatbot Activity 5
Presentation transcript:

AP ® Marine Biology Simulation Case Study Alyce Brady Kalamazoo College

The Story n A CS student, Pat, gets a summer job working for marine biologists. n Hired to enhance an existing program that simulates fish movement in a bounded environment. u Needs to understand existing program u Designs, codes, and tests modifications n Occasionally Pat turns to an experienced programmer, Jamie, for help. n Narrative is Pat’s report of summer job.

The Package n Code for the “existing” program u Source for core classes u Jar files for “black box” & GUI classes n Javadoc documentation for most classes n Data Files n Instructions for compiling/running n Narrative (pdf file)

The Modules (Chapters) n Experiment with existing program (run it) n Guided tour of the code by Jamie n Add breeding and dying n Add two new kinds of fish (inheritance) n Provide alternative representations (unbounded environment, others)

First Day on the Job n “[The program] was designed to help the marine biologists study fish movement in a bounded environment, such as a lake or a bay.” n Jamie not available until the next day. n Pat is given instructions for running the program and told where to find data files. Chapter 1

Exploring the MBS Files n Examine the folders from the zip file n Black Box Source Code n GUI Source n JavaMBS --- Contains Source Code n Documentation (HTML Docs) n Narrative (2002_MBS.pdf) n Open the Index.html and look around n Open the 2002_MBS.pdf and look around n Look at the data files

Guided Tour n “The biologists think of the environment as a rectangular grid, with fish moving from cell to cell in the grid. Each cell contains zero or one fish.” Chapter 2

What classes are necessary? To model fish swimming in a bounded environment, the program has Fish objects and an Environment object. To model fish swimming in a bounded environment, the program has Fish objects and an Environment object. The purpose of the program is to simulate fish moving in the environment, so the program also has a Simulation object. The purpose of the program is to simulate fish moving in the environment, so the program also has a Simulation object. n There are other useful, but less important "utility classes." Chapter 2

Run the Initial MBS n Run SimpleDemo1 with Fish that simply move (use OrigFishLE3.mcp) n Examine the code, notice no simulation class Chapter 2

Run the Second MBS n Run SimpleDemo2 with Fish that simply move (use OrigFishLE3.mcp) n Examine the code, notice the use of the simulation class Chapter 2

One step in the simulation Chapter 2

What do core classes look like? Simulation: step method - very simple loop through all the fish (see p. 21) Simulation: step method - very simple loop through all the fish (see p. 21) n Environment: black box; only look at class documentation (until Chap 5) n Fish: u has color, direction  move method is a little more complicated, has more helper methods Chapter 2

Constructors n Initialize instance variables n Add the fish to the environment u a fish knows about its environment u must always be in an environment to be in a consistent state n See pp Chapter 2

move method Get next location to move to (call nextLocation ) Get next location to move to (call nextLocation ) n If next location is different from this location,  move there (call changeLocation )  change direction (call changeDirection ) Chapter 2

nextLocation method Get list of empty neighboring locations (call emptyNeighbors ) Get list of empty neighboring locations (call emptyNeighbors ) n Remove location behind fish from list n If there are any empty neighbors left, randomly choose one; otherwise return current location Chapter 2

Run the GUI Version MBS n Run MBSGUI with Fish that simply move (use OrigFishLE3.mcp) n Examine the code, Black Box Chapter 2

Breeding and Dying n Problem Specification: A fish should... u have a 1 in 7 chance of breeding, u breed into all empty neighboring locations, u attempt to move when it does not breed, u never move backwards, and u have a 1 in 5 chance of dying after it has bred or moved. Chapter 3

Breeding and Dying Pseudo-code for act method if this is the 1 in 7 chance of breeding if this is the 1 in 7 chance of breeding call the breed method call the breed method else else call the move method call the move method if this is the 1 in 5 chance of dying if this is the 1 in 5 chance of dying call the die method call the die method Chapter 3

Lets look at the Fish Class Modifications for Breeding & Dying Examine the modified fish class that includes breeding and dying Marine Biology Case Simulation\JavaMBS\Code\ DynamicPopulation\fish.java Chapter 3

Specialized Fish n Different patterns of movement  Darters ( DarterFish )  Slow fish ( SlowFish ) n Inheritance n Dynamic Binding Chapter 4

Specialized Fish DarterFish DarterFish u darts two cells forward if possible u or darts one cell forward u or reverses direction (without moving) Chapter 4

Specialized Fish SlowFish SlowFish u has only a 1 in 5 chance of moving out of current cell  otherwise movement is the same as Fish Chapter 4

Run the Dynamic Fish Version n Marine Biology Case Simulation\JavaMBS\Code\DynPopLE3 n Note darter and slow fish n Create and SAVE New Environments

Environment Implementations n Multiple environment implementations u Environment Interface u Bounded: 2D array (matrix) -- existing u Unbounded: ArrayList of Fish -- Pat develops this implementation Chapter 5

“AB” Exam Summary n Class Implementations  Simulation (Chap 2)  Fish (Chaps 2 & 3)  DarterFish (Chap 4)  SlowFish (Chap 4) n Additional Class Interfaces/Implementations  Environment  BoundedEnv  UnboundedEnv n Class Documentation u One new utility class

MBS Debugger n debug.turnOn( ) n debug.turnOff( ) n Demonstrate the Debugger

MBS Role Playing n Get to better understand the Case Study by “Role Playing” a Simulation Step