// CSE 142 Lecture 21 // Static Members // This class represents a Snake that moves an increasing distance // East and West between moves South. It always forfeits in a fight, // never eats, is black, and is displayed as a "S". public class Snake extends Critter { private int length; private int step; public Snake() { length = 1; step = 0; } public String toString() { return "S"; } public Direction getMove() { step++; if (step > length) { step = 0; length++; return Direction.SOUTH; } if (length % 2 == 1) { return Direction.EAST; } else { return Direction.WEST; } } }