FitnessEvaluation.SantaFeAntTrail
Class SanMateoTrail

java.lang.Object
  extended by FitnessEvaluation.SantaFeAntTrail.Trail
      extended by FitnessEvaluation.SantaFeAntTrail.SanMateoTrail

public class SanMateoTrail
extends Trail

Taken from lib GE and refactored to java

Author:
erikhemberg

Field Summary
static int GRID_HEIGHT
           
static int GRID_WIDTH
           
 int move
           
 int trailCnt
           
static java.util.LinkedList<int[][]> trails
           
 int turn
           
 
Fields inherited from class FitnessEvaluation.SantaFeAntTrail.Trail
_current_X, _current_Y, _energy, _facing_current_X, _facing_current_Y, _picked_up, _trail, _working_trail, ANT, EMPTY, food, FOOD
 
Constructor Summary
SanMateoTrail()
          Creates a new instance of Trail.
SanMateoTrail(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.
 int get_Energy()
          Get the energy
 boolean getTrail(int energy)
          Get the trail.
 void left()
          Turn the ant left
 void move()
          Move the ant forward Death on the electric fence
 void right()
          Turn the ant right
 
Methods inherited from class FitnessEvaluation.SantaFeAntTrail.Trail
get_Energy_Left, get_Picked_Up, getFitness, getFood
 
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

trails

public static java.util.LinkedList<int[][]> trails

turn

public int turn

move

public int move

trailCnt

public int trailCnt
Constructor Detail

SanMateoTrail

public SanMateoTrail()
Creates a new instance of Trail.


SanMateoTrail

public SanMateoTrail(int energy)
Create new instance

Parameters:
energy - ant stamina
Method Detail

getTrail

public boolean getTrail(int energy)
Get the trail. If Energy is <= 0 a new trail is started. If there are more trails true is returned

Returns:
if there are more trails

right

public void right()
Description copied from class: Trail
Turn the ant right

Overrides:
right in class Trail

left

public void left()
Description copied from class: Trail
Turn the ant left

Overrides:
left in class Trail

get_Energy

public int get_Energy()
Description copied from class: Trail
Get the energy

Overrides:
get_Energy in class Trail
Returns:
energy

move

public void move()
Move the ant forward Death on the electric fence

Overrides:
move in class Trail

food_ahead

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

Overrides:
food_ahead in class Trail
Returns:
food ahead is 1, else 0