|
JGAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectexamples.gp.paintedDesert.AntMap
public class AntMap
Holds the map of the painted desert sand locations
Field Summary | |
---|---|
static int |
ANT_AT_POSITION
Ant at this location |
static int |
BLACK
Black sand at this location or carried by the ant |
static int |
EMPTY
No Sand at this location or carried by the ant |
static int |
GRAY
Gray sand at this location or carried by the ant |
static int |
STRIPED
Striped sand at this location or carried by the ant |
Constructor Summary | |
---|---|
AntMap(int[][] a_map,
Ant[] a_ants)
Creates the map. |
Method Summary | |
---|---|
int |
atLocation(int x,
int y)
Returns the color of sand at the provided location |
void |
finalize()
Determine the final position of grains of sand. |
int |
fitness()
Calculates how well the sand is moved to the proper columns. |
Ant |
getAnt()
Returns the current Ant. |
Ant[] |
getAnts()
Returns this list of ants |
int |
getHeight()
Returns the height of the map |
int[][] |
getInitialMap()
Returns a representation of the initial map |
int[][] |
getMap()
Returns a representation of the current map |
int |
getMoveCount()
Asks each ant for the number of moves and sums up the result. |
int |
getWidth()
Returns the width of the map |
void |
init()
|
boolean |
mayDropSand(int x,
int y)
Identifies that sand may be placed here |
Ant |
nextAnt()
Increments the index to the next ant. |
void |
placeSand(int sandColor,
int x,
int y)
Places sand or identifies an empty spot at the current position |
int |
removeSand(int x,
int y)
Removes the sand from the current position |
void |
resetMap()
Resets the sand and ant back to their positions before the program was applied |
boolean |
sandAtLocation(int x,
int y)
Identifies whether there is sand at the provided location |
boolean |
sandBelongsHere(int sandColor,
int x)
Identifies that sand is at that location |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int EMPTY
public static final int BLACK
public static final int GRAY
public static final int STRIPED
public static final int ANT_AT_POSITION
Constructor Detail |
---|
public AntMap(int[][] a_map, Ant[] a_ants)
a_map
- the map itselfa_ants
- the list of antsMethod Detail |
---|
public void placeSand(int sandColor, int x, int y)
sandColor
- x
- y
- public int atLocation(int x, int y)
x
- y
-
public int[][] getMap()
public int[][] getInitialMap()
public boolean sandAtLocation(int x, int y)
x
- y
-
public boolean sandBelongsHere(int sandColor, int x)
sandColor
- x
-
public boolean mayDropSand(int x, int y)
x
- y
-
public int removeSand(int x, int y)
x
- y
-
public Ant getAnt()
public void finalize()
finalize
in class java.lang.Object
Object.finalize()
public int fitness()
public Ant nextAnt()
public int getMoveCount()
public int getWidth()
public int getHeight()
public Ant[] getAnts()
public void init()
public void resetMap()
|
JGAP | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |