Class AI

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    EnemyAI, PlayerAStarAI, PlayerBreadthFirstAI

    public class AI
    extends java.lang.Object
    implements java.lang.Runnable
    AI algorithms extends this class
    • Constructor Summary

      Constructors 
      Constructor Description
      AI()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDestination​(State destination)
      Add a destination to the list of destinations
      protected boolean getActive()
      Get the active state of the AI
      protected java.util.logging.Logger getLogger()
      Get the logger being used by the AI
      void removeKeyDestination​(int x, int y)
      Remove the picked up key from destinations if it is there
      void run()
      The AI should run in a loop
      void setActive​(boolean active)
      Set the active state for the AI loop
      protected void setLogger​(java.util.logging.Logger logger)
      Set the logger that the AI should use
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AI

        public AI()
    • Method Detail

      • getActive

        protected boolean getActive()
        Get the active state of the AI
        Returns:
        Returns true if the AI is active or false otherwise
      • setActive

        public void setActive​(boolean active)
        Set the active state for the AI loop
        Parameters:
        active - Set to true to have the run method loop run indefinitely or false to stop the loop
      • getLogger

        protected java.util.logging.Logger getLogger()
        Get the logger being used by the AI
        Returns:
        Returns the logger
      • setLogger

        protected void setLogger​(java.util.logging.Logger logger)
        Set the logger that the AI should use
        Parameters:
        logger - The logger to use
      • addDestination

        public void addDestination​(State destination)
                            throws AIException
        Add a destination to the list of destinations
        Parameters:
        destination - The destination
        Throws:
        AIException - Thrown when the parent method is called directly
      • removeKeyDestination

        public void removeKeyDestination​(int x,
                                         int y)
                                  throws AIException
        Remove the picked up key from destinations if it is there
        Parameters:
        x - The x coordinate of the key
        y - The y coordinate of the key
        Throws:
        AIException - Thrown when the parent method is called directly
      • run

        public void run()
        The AI should run in a loop
        Specified by:
        run in interface java.lang.Runnable