예제 #1
0
 public static void main(String[] args) {
   ActorWorld world = new ActorWorld();
   world.addGridClass("SparseBoundedGrid");
   world.addGridClass("SparseBoundedGrid1");
   world.addGridClass("SparseBoundedGrid2");
   world.addGridClass("SparseBoundedGrid3");
   world.addGridClass("UnboundedGrid2");
   world.setGrid(new SparseBoundedGrid3<Actor>(10, 10));
   world.add(new Location(5, 6), new Bug());
   world.add(new Location(4, 3), new Critter());
   world.show();
 }
예제 #2
0
  public static void main(String[] args) {
    // ActorWorld world = new ActorWorld(new UnboundedGrid2<Actor>());
    ActorWorld world = new ActorWorld(new SparseBoundedGrid<Actor>(30, 30));
    // ActorWorld world = new ActorWorld(new SparseBoundedGrid2<Actor>(30, 30));
    // ActorWorld world = new ActorWorld();
    world.addGridClass("SparseBoundedGrid");
    world.addGridClass("SparseBoundedGrid2");
    world.addGridClass("UnboundedGrid2");
    world.add(new Location(4, 4), new Bug());
    world.add(new Location(2, 2), new Bug());
    // world.remove(new Location(2, 2));
    world.add(new Location(3, 2), new Bug());
    world.show();

    // world.show();
  }