package models.gridobjects.creatures;

import models.gridobjects.GridObject;

public class Creature extends GridObject {

	/**
	 * The directional value of Up.
	 */
	public static final int UP = 0;
	
	/**
	 * The directional value of Down.
	 */
	public static final int DOWN = 1;
	
	/**
	 * The directional value of Left.
	 */
	public static final int LEFT = 2;
	
	/**
	 * The directional value of Right.
	 */
	public static final int RIGHT = 3;
	
	/**
	 * The number of bamboos the creature is currently holding.
	 */
	private int numberOfBamboo;
	
	/**
	 * The direction of the creature that is currently pointing towards.
	 */
	private int direction;
	
	/*
	 * Is the creature awake.
	 */
	private boolean isAwake;
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 6L;
	
	/**
	 * Creature's Constructor 
	 * @param name The name of the creature.
	 * @param xcoordinate The xcoordinate of the creature.
	 * @param ycoordinate The ycoordinate of the creature.
	 */
	public Creature(String name, int xcoordinate, int ycoordinate){
		this.setName(name);
		this.setCoordinates(xcoordinate, ycoordinate	);
	}
	
	/**
	 * Moves the object up one in the World
	 */
	public void moveUp(){
		this.setYCoordinate(this.getY() + 1);
	}
	
	/**
	 * Moves the object down one in the World
	 */
	public void moveDown(){
		this.setYCoordinate(this.getY()- 1);
	}
	
	/**
	 * Moves the object left one in the World 
	 */
	public void moveLeft(){
		this.setXCoordinate(this.getX() - 1);
	}
	/**
	 * Moves the object right one in the World 
	 */
	public void moveRight(){ 
		this.setXCoordinate(this.getX() + 1);
	}
	
	/**
	 * Give a bamboo to a creature.
	 * 
	 * @param creature  the creature to give bamboo to 
	 */
	public void giveBamboo(Creature creature){
		this.numberOfBamboo--;
		creature.incrementBamboo();
		
	}
	
	/**
	 * Take a bamboo from a creature.
	 * @param creature Take a bamboo from that creature. 
	 */
	public void takeBamboo(Creature creature){
		this.numberOfBamboo++;
		creature.decrementBamboo();
	}
	
	/**
	 * Add 1 bamboo to this creature. 
	 */
	public void incrementBamboo(){
		this.numberOfBamboo++;
	}
	
	/**
	 * Minus 1 bamboo to this creature.
	 */
	private void decrementBamboo(){
		if(this.numberOfBamboo > 0){ this.numberOfBamboo--; }
	}
	
	/**
	 * Set the direction of the creature.
	 * @param direction  the (new) direction of the creature
	 */
	public void setDirection(int direction){
		this.direction = direction;
	}
	
	/**
	 * Gets the direction of the creature
	 * 
	 * @return The creature direction.
	 */
	public int getDirection(){
		return this.direction;
	}
	
	/**
	 * Set the status of the creature awake.
	 * @param isAwake True = awake. Otherwise false.
	 */
	public void setAwake(boolean isAwake){
		this.isAwake = isAwake;
	}
	
	/**
	 * Checks to see if the creature is awake or asleep 
	 * 
	 * @return true iff the creature is awake.
	 */
	public boolean isAwake(){
		return this.isAwake;
	}
	
	/**
	 * Returns the identifier. 
	 */
	public String toString(){
		return String.valueOf(Character.toUpperCase(this.getName().charAt(0)));
	}
}

@@ -32,16 +32,42 @@
 tures;%0A%0A
+import models.Coordinate;%0A
 import m
@@ -750,24 +750,73 @@
 *%0A%09 * %0A%09 */%0A
+%09private Coordinate coordinate;%0A%09%0A%09/**%0A%09 * %0A%09 */%0A
 %09private sta
@@ -1081,14 +1081,9 @@
 me, 
-int xc
+C
 oord
@@ -1091,15 +1091,9 @@
 nate
-, int y
+ 
 coor
@@ -1145,17 +1145,16 @@
 dinates(
-x
 coordina
@@ -1159,22 +1159,8 @@
 nate
-, ycoordinate%09
 );%0A%09
@@ -1236,37 +1236,33 @@
 oveUp()%7B%0A%09%09this.
-setYC
+c
 oordinate(this.g
@@ -1258,24 +1258,19 @@
 nate
-(this.getY() + 1
+.moveNorth(
 );%0A%09
@@ -1362,13 +1362,9 @@
 his.
-setYC
+c
 oord
@@ -1372,23 +1372,19 @@
 nate
-(this.getY()- 1
+.moveSouth(
 );%0A%09
@@ -1465,37 +1465,33 @@
 eLeft()%7B%0A%09%09this.
-setXC
+c
 oordinate(this.g
@@ -1487,24 +1487,18 @@
 nate
-(this.getX() - 1
+.moveWest(
 );%0A%09
@@ -1592,13 +1592,9 @@
 his.
-setXC
+c
 oord
@@ -1602,24 +1602,18 @@
 nate
-(this.getX() + 1
+.moveEast(
 );%0A%09

Change the Creature Class