Greeps - PowerPoint PPT Presentation

About This Presentation
Title:

Greeps

Description:

Greeps A programming Competition Greeps Description Greeps Scenario (a .zip file) Project 1: modify the Greeps class to increase your score in the competition On-line ... – PowerPoint PPT presentation

Number of Views:13
Avg rating:3.0/5.0
Slides: 9
Provided by: Rebecca284
Learn more at: https://www.cs.unca.edu
Category:
Tags: greeps

less

Transcript and Presenter's Notes

Title: Greeps


1
Greeps
  • A programming Competition

2
Greeps
  • Description
  • Greeps Scenario (a .zip file)
  • Project 1 modify the Greeps class to increase
    your score in the competition
  • On-line hint
  • Greeps.java

3
Methods Provided
Actor class getIntersectingObjects
(java.lang.Class cls) getOneIntersectingObject
(java.lang.Class cls) getRotation()
getWorld() getX() getY() setLocation(int x,
int y) setRotation(int rotation
Creature class
  • Greep class
  • act()
  • checkFood()
  • getAuthorName()

atShip() atWater() atWorldEdge()
carryingTomato() dropTomato()
getFlag(int flagNo) getMemory() loadTomato()
move() randomChance(int percent)
removeTomato() seePaint(java.lang.String color)
setFlag(int flagNo, boolean val)
setMemory(int val) spit(java.lang.String color)
turn(int angle) turnHome()
4
Turning
public void act () turn (5)
5
Where the action is act ()
Current plan
Possible problems
if (carryingTomato()) if(atShip())
dropTomato()
else turnHome()
move()
else move()
checkFood()
reaching the world boundary reaching water
Possible changes
if(atWater() atWorldEdge()) turn
(????)
6
Possible States and Strategies
  • With Respect to the Tomatoes
  • Holding a tomato
  • Go home (and leave a trail?)
  • Not holding nor near a tomato
  • Search for tomatoes (follow a trail?)
  • At a pile of tomatoes
  • Wait there until they are gone?
  • With Respect to obstacles/location
  • At waters edge
  • Turn?
  • Move?
  • Leave a trail?
  • Follow a trail?
  • 2) At worlds edge
  • Turn?
  • Move?
  • Leave a trail?
  • Follow a trail?
  • At ship (after dropping tomatoes)
  • Turn?
  • Move?
  • Leave a trail?
  • Follow a trail?

7
What To Do
  • Devise a strategy
  • What to do in each state
  • How to use spit (3 colors)
  • How to use memory (1 int variable)
  • Implement your strategy as a program
  • Be prepared to make changes
  • Report your progress
  • Test and refine your program
  • Turn in final program

Due Today
Due Next Class
Due Next Tuesday _at_ midnight
8
Example Error Messages
  • expected
  • cannot find symbol - method Move()
  • turn(int) in Creature cannot be applied to
    (int,int)
  • turn(int) in Creature cannot be applied to
    (double)
  • act() in Greep cannot override act() in Creature
    attempting to use incompatible return type
Write a Comment
User Comments (0)
About PowerShow.com