A closer look at the world

Slides:



Advertisements
Similar presentations
GridWorld Case Study The Classes A Summary by Jim Mims.
Advertisements

GridWorld Case Study Part 3 GridWorld Classes and Interfaces A Summary by Jim Mims.
For(int i = 1; i
© A+ Computer Science - GridWorld © A+ Computer Science -
Number Grid Task Task 1Task 2Task 3Task 4 Task 5Task 6Task 7Task 8 Task 9Task 10 NC Level 5 to 8.
Grid method for multiplying by a 1 digit number. 1.Firstly, write the multiplication sum and then draw the grid. The largest number goes at the top so.
Big Ideas behind Inheritance. Can you think of some possible examples of inheritance hierarchies?
Critters A Study in Design Patterns. Design Patterns  Not specific algorithms or data structures  A general reusable solution to a common problem.
Location Class Gridworld. Location Class Encapsulates the coordinates for an actor’s position in a grid – Row and Column number Rows increase going down.
Stacks. What is a stack? Last-in first-out data structure (LIFO) New objects are placed on top Removal restricted to top object Examples?
Arrays An array is a collection of variables, all of the same type. An array is created with the new operator. The size of an array must be specified at.
Building Memory… Day 5 – November 27, Need to flip cards Create a remove method to remove from drawing canvas Call a show method to show on the.
Stacks.
Chapter 13 Linked Structures - Stacks. Chapter Scope Object references as links Linked vs. array-based structures Managing linked lists Linked implementation.
GridWorld Case Study1 Barbara Ericson Georgia Tech Jan 2008.
Box Method for Factoring Factoring expressions in the form of.
Agenda Scope of variables Comparable interface Location class in GridWorld homework.
Variables Independent Variable-The thing changed Dependent Variable-The thing measured. Control Variables: things that are constant among all groups.
1 Review for the AP CS Exam  Object Oriented Program Design – Program Design Read and Understand class specifications and relationships among the classes.
© A+ Computer Science - Row = 0 Column = 0.
GridWorld Case Study Barbara Ericson March 24, 2007.
Java Arrays  Java has a static array capable of multi-dimensions.  Java has a dynamic array, which is also capable of multi-dimensions.  The ArrayList.
© A+ Computer Science - Grid is an interface that details the behaviors expected of a grid. All its methods are abstract methods.
TIC TAC TOE. import java.util.Scanner; import java.util.Random; public class PlayTTT{ public static void main(String[]args){ Scanner reader = new Scanner(System.in);
Step 1: Place x 2 term and constant into the box 2x 2 2 PROBLEM: 2x 2 + 5x + 2.
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.
Section 4.4. a) Factor x 2 + 5x - 36 (x + 9)(x – 4) b) Factor 2x 2 – 20x + 18 Hint: factor out a 2 first 2(x-9)(x-1) c) Factor 2x 2 + x – 6 Why doesn’t.
Object Oriented Programming (OOP) is a style of programming that incorporates these 3 features: Encapsulation Polymorphism Class Interaction.
GridWorld Case Study The case study is a program that simulates actions and interactions of objects in a two- dimensional grid. During a single step of.
Chomp. How is the game played Human player goes first choose a square, all to the right and down are “eaten” computer takes a turn whoever is forced to.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
Matrix Multiplication The Introduction. Look at the matrix sizes.
Answer these quick fire questions on your mini whiteboards.
CHAPTER 13B Object Oriented Programming (Tutorial)
2-POINT PERSPECTIVE. Exercise: Follow the next steps in order to create a box in a 2-point perspective.
Object Oriented Programming (OOP) is a style of programming that incorporates these 3 features: Encapsulation Polymorphism Class Interaction.
1 Tirgul 11: Recursion & Backtracking. 2 Elements of a recursive solution (Reminder) A base case that is so simple we need no computation to solve it.
GridWorld.
Year 5 - Numeracy Title page..
12-4: Matrix Methods for Square Systems
Matrices Rules & Operations.
UNIT – I Linked Lists.
Box Method for Factoring
Box Method for Factoring
Efficiency of in Binary Trees
GridWorld Part 4 Meet the Critters.
Agenda About Quiz ChameleonCritter class CrabCritter class homework.
Barbara Ericson Georgia Tech Jan 2008
AP "Case Studies" A big program for AP students to understand
Chapter 4 Linked Structures - Stacks
Parallel Lines Discovery Activity
Adding and Subtracting Decimals
Dimensional Analysis Review.
2D Arrays October 12, 2007 ComS 207: Programming I (in Java)
© A+ Computer Science - GridWorld © A+ Computer Science -
Lattice Multiplication
Parallel Lines Discovery Activity
First we need to draw a place table grid. Then write our number in it
Binary Search Trees A special case of a Binary Tree
Transversal: Parallel Lines and Transversals
Area Models A strategy for Multiplication
A line that intersects two or more lines at different points
GridWorld Part 4 Meet the Critters.
© A+ Computer Science - GridWorld The GridWorld case study provides a graphical environment where visual objects inhabit and interact.
© A+ Computer Science - GridWorld © A+ Computer Science -
The Array is Not Enough.
GridWorld Case Study.
Reference Angles.
Agenda Dancing bug class Class vs object Comparable interface
Presentation transcript:

A closer look at the world Grid World Part 3 A closer look at the world

Class interactions

Location class (0,0) is top left of grid Constants for direction (row, column) Constants for direction Location.NORTH Constants for common turn angles Location.LEFT, Location.HALF_RIGHT are -90 and 45

Location Methods public Location(int r, int c) public int getRow() public int getCol() public Location getAdjacentLocation(int direction) public int getDirectionToward(Location target) .equals(Location other) .compareTo(Location other) closest to upper left corner goes first

Grid Interface Implemented by BoundedGrid and UnboundedGrid boolean isValid(Location loc) E put(Location loc, E obj) Put object at location and return previous inhabitant or null E remove(Location loc) E get(Location loc) ArrayList<Location> getOccupiedLocations() int getNumRows() int getNumCols()

Grid continued Methods to collect info about surroundings ArrayList<Location> getValidAdjacentLocations(Location loc) ArrayList<Location> getEmptyAdjacentLocations(Location loc) ArrayList<Location> getOccupiedAdjacentLocations(Location loc) ArrayList<Actor> getNeighbors(Location loc)