zinger.nibbles
Class Snake

java.lang.Object
  |
  +--zinger.nibbles.Entity
        |
        +--zinger.nibbles.Snake
All Implemented Interfaces:
Constants

public class Snake
extends Entity
implements Constants


Field Summary
protected  java.util.LinkedList body
           
protected  SpaceOccupantDrawer drawer
           
protected  SnakeDriver driver
           
protected  int reproductionCycle
           
protected  int targetCount
           
 
Fields inherited from class zinger.nibbles.Entity
field, level
 
Fields inherited from interface zinger.nibbles.Constants
DIRECTIONS, DOWN, LEFT, LOAD_METHOD_NAME, LOAD_PARAMETER_TYPES, MAIN_PROPERTIES_FILE, RIGHT, SNAKE_LEVEL, TARGET_LEVEL, UP
 
Constructor Summary
(package private) Snake(Field field, SnakeDriver driver, SpaceOccupantDrawer drawer, int reproductionCycle, int initialLength, int x, int y)
           
 
Method Summary
(package private)  boolean advance()
           
 SpaceOccupantDrawer getDrawer(SpaceOccupant s)
           
 SpaceOccupant getHead()
           
(package private)  void gotEaten(Entity entity)
           
(package private)  void grow(int length)
          Makes the snake grow by length.
(package private)  java.util.Iterator occupants()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

body

protected final java.util.LinkedList body

driver

protected final SnakeDriver driver

drawer

protected final SpaceOccupantDrawer drawer

reproductionCycle

protected final int reproductionCycle

targetCount

protected int targetCount
Constructor Detail

Snake

Snake(Field field,
      SnakeDriver driver,
      SpaceOccupantDrawer drawer,
      int reproductionCycle,
      int initialLength,
      int x,
      int y)
Method Detail

getHead

public SpaceOccupant getHead()

advance

final boolean advance()
Overrides:
advance in class Entity

getDrawer

public SpaceOccupantDrawer getDrawer(SpaceOccupant s)
Overrides:
getDrawer in class Entity

occupants

java.util.Iterator occupants()
Overrides:
occupants in class Entity

grow

void grow(int length)
Makes the snake grow by length.

gotEaten

void gotEaten(Entity entity)
Overrides:
gotEaten in class Entity