FitnessEvaluation.SantaFeAntTrail
Class Trail

java.lang.Object
  extended by FitnessEvaluation.SantaFeAntTrail.Trail
Direct Known Subclasses:
LosAltosTrail, SanMateoTrail

public class Trail
extends java.lang.Object

Taken from lib GE and refactored to java

Author:
erikhemberg

Field Summary
 int _current_X
           
 int _current_Y
           
 int _energy
           
 int _facing_current_X
           
 int _facing_current_Y
           
 int _picked_up
           
 int[][] _trail
           
 int[][] _working_trail
           
static int ANT
           
static int EMPTY
           
 int food
           
static int FOOD
           
static int GRID_HEIGHT
           
static int GRID_WIDTH
           
 
Constructor Summary
Trail()
          Creates a new instance of Trail.
Trail(int energy)
          Create new instance
 
Method Summary
 int food_ahead()
          Check if there is food in the square ahead. 0 is false, 1 is true.
 boolean get_Energy_Left()
          Get energy left
 int get_Energy()
          Get the energy
 int get_Picked_Up()
          get food picked up
 double getFitness()
          Get fitness.
 int getFood()
          Get food
 void left()
          Turn the ant left
 void move()
          Move the ant forward
 void right()
          Turn the ant right
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRID_WIDTH

public static final int GRID_WIDTH
See Also:
Constant Field Values

GRID_HEIGHT

public static final int GRID_HEIGHT
See Also:
Constant Field Values

EMPTY

public static final int EMPTY
See Also:
Constant Field Values

FOOD

public static final int FOOD
See Also:
Constant Field Values

ANT

public static final int ANT
See Also:
Constant Field Values

_energy

public int _energy

_picked_up

public int _picked_up

_trail

public int[][] _trail

_working_trail

public int[][] _working_trail

food

public int food

_current_X

public int _current_X

_current_Y

public int _current_Y

_facing_current_X

public int _facing_current_X

_facing_current_Y

public int _facing_current_Y
Constructor Detail

Trail

public Trail()
Creates a new instance of Trail. Calling initGEtrail with 600


Trail

public Trail(int energy)
Create new instance

Parameters:
energy - ant stamina
Method Detail

get_Energy

public int get_Energy()
Get the energy

Returns:
energy

get_Energy_Left

public boolean get_Energy_Left()
Get energy left

Returns:
energy left

getFood

public int getFood()
Get food

Returns:
food

get_Picked_Up

public int get_Picked_Up()
get food picked up

Returns:
food picked up

getFitness

public double getFitness()
Get fitness. Food on trail - food picked up

Returns:
food left

left

public void left()
Turn the ant left


right

public void right()
Turn the ant right


move

public void move()
Move the ant forward


food_ahead

public int food_ahead()
Check if there is food in the square ahead. 0 is false, 1 is true.

Returns:
food ahead is 1, else 0