Class Grasshopper

  • All Implemented Interfaces:
    Aerial

    public class Grasshopper
    extends Animal
    implements Aerial
    Grasshopper Class
    Since:
    0.2.0
    Version:
    2.0.0
    Author:
    Andrew SASSOYE
    • Constructor Detail

      • Grasshopper

        public Grasshopper()
      • Grasshopper

        public Grasshopper​(Position positionOnBoard)
    • Method Detail

      • toString

        public String toString()
        Grasshopper toString for View
        Overrides:
        toString in class Object
        Returns:
        Grasshopper
      • move

        public Position move​(Board board,
                             Direction direction,
                             Animal[] animals)
        Move animal in given direction
        Specified by:
        move in class Animal
        Parameters:
        board - Board
        direction - Direction of movement
        animals - Animal array
        Returns:
        Position of moved animal, null if fallen