public class TreasureHunterEnvironment
extends java.lang.Object
implements java.io.Closeable
Modifier and Type | Field and Description |
---|---|
static double |
HEIGHT
The environment width.
|
protected java.util.Set<Treasure> |
islands
The collected treasures (just for painting).
|
protected java.awt.geom.Point2D.Double |
location
The treasure hunter location.
|
protected jadex.bdiv3.quickstart.treasureisland.environment.EnvironmentPanel |
panel
The gui.
|
protected java.util.Random |
rnd
The random number generator.
|
protected java.util.Set<Treasure> |
treasures
The treasures.
|
static double |
WIDTH
The environment width.
|
Constructor and Description |
---|
TreasureHunterEnvironment()
Create a treasure hunter world of given size.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Auto close the gui when the agent is killed.
|
java.awt.geom.Point2D |
getHunterLocation()
Get the treasure hunter location.
|
java.util.Set<Treasure> |
getTreasures()
Get the current treasures.
|
boolean |
isAtLocation(java.awt.geom.Point2D location)
Check if the hunter is at (i.e.
|
jadex.commons.future.IFuture<java.lang.Void> |
move(double dx,
double dy)
Try to move a given distance.
|
jadex.commons.future.IFuture<java.lang.Void> |
pickUp(Treasure treasure)
Pickup a treasure.
|
public static final double WIDTH
public static final double HEIGHT
protected java.util.Random rnd
protected java.awt.geom.Point2D.Double location
protected java.util.Set<Treasure> treasures
protected java.util.Set<Treasure> islands
protected jadex.bdiv3.quickstart.treasureisland.environment.EnvironmentPanel panel
public TreasureHunterEnvironment()
width
- The width (in pixels).height
- The height (in pixels).public java.awt.geom.Point2D getHunterLocation()
public java.util.Set<Treasure> getTreasures()
public jadex.commons.future.IFuture<java.lang.Void> move(double dx, double dy)
dx
- The intended horizontal movement, i.e. delta-x.dy
- The intended vertical movement, i.e. delta-y.public jadex.commons.future.IFuture<java.lang.Void> pickUp(Treasure treasure)
treasure
- The treasure to be picked up.public boolean isAtLocation(java.awt.geom.Point2D location)
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable