1 / 8

Greeps

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 hint Greeps.java. Methods Provided. Creature class. Actor class getIntersectingObjects

kail
Download Presentation

Greeps

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 Creature class Actor class getIntersectingObjects (java.lang.Class cls) getOneIntersectingObject (java.lang.Class cls) getRotation() getWorld() getX() getY() setLocation(int x, int y) setRotation(int rotation … 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() Greep class act() checkFood() getAuthorName()

  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 water’s edge • Turn? • Move? • Leave a trail? • Follow a trail? • 2) At world’s 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 @ 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

More Related