grid world help

clearing the grid as a menu tab

Page 1 of 1

1 Replies - 3554 Views - Last Post: 14 December 2009 - 03:26 PM Rate Topic: -----

#1 clueless616   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 07-December 09

grid world help

Posted 14 December 2009 - 03:09 PM

i'm using grid world in ap computer science and i was wondering if there was a way to clear the entire grid of all objects. i don't want to highlight each spot and press delete. if i could somehow put it as a menu drop down button that would be awesome!! ty o and i dont want someone to make the code for me. i want to do this on my own but i don't know how to go about it. any help is really appreciated!
Is This A Good Question/Topic? 0
  • +

Replies To: grid world help

#2 Dogstopper   User is offline

  • The Ninjaducky
  • member icon

Reputation: 2965
  • View blog
  • Posts: 11,222
  • Joined: 15-July 08

Re: grid world help

Posted 14 December 2009 - 03:26 PM

Get the grid using the getGrid method. That's usually the hardest part of this. Then on that Grid object, call
// Say you have an World object called world
ArrayList<Location> locs = world.getGrid().getOccupiedLocations();
for (Location l : locs) {

I know that may not help MUCH because GridWorld is not well documented and does not say that sort of thing. Here is the best I could find: http://www.horstmann...dworld/javadoc/
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1