Class FieldModel


  • public final class FieldModel
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      boolean[][] obstacles
      obstacles obstacle in field model
      int[][] visits
      visits
    • Constructor Summary

      Constructors 
      Constructor Description
      FieldModel​(int w, int h)
      Constructor: FieldModel.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void calcDistance​(int mx, int my)  
      void clearDistance()
      clears the first buffer
      void clearRange​(int x, int y, int r, int round)  
      boolean getNearerLocation​(IVector2 loc)  
      protected int goD​(int x, int y, int d)  
      protected int goL​(int x, int y, int d)  
      protected int goR​(int x, int y, int d)  
      protected int goU​(int x, int y, int d)  
      • Methods inherited from class java.lang.Object

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

      • obstacles

        public final boolean[][] obstacles
        obstacles obstacle in field model
      • visits

        public final int[][] visits
        visits
    • Constructor Detail

      • FieldModel

        public FieldModel​(int w,
                          int h)
        Constructor: FieldModel.
        Parameters:
        w - width
        h - height
    • Method Detail

      • getNearerLocation

        public final boolean getNearerLocation​(IVector2 loc)
        Parameters:
        loc - the location the values should be stored to (in, out)
        Returns:
        false if this location has distance <= 0, true if location changed
      • calcDistance

        public void calcDistance​(int mx,
                                 int my)
        Parameters:
        mx - - from x
        my - - from y
      • goR

        protected final int goR​(int x,
                                int y,
                                int d)
        Parameters:
        x -
        y -
        d -
        Returns:
        own distance
      • goD

        protected final int goD​(int x,
                                int y,
                                int d)
        Parameters:
        x -
        y -
        d -
        Returns:
        own distance
      • goL

        protected final int goL​(int x,
                                int y,
                                int d)
        Parameters:
        x -
        y -
        d -
        Returns:
        own distance
      • goU

        protected final int goU​(int x,
                                int y,
                                int d)
        Parameters:
        x -
        y -
        d -
        Returns:
        own distance
      • clearDistance

        public void clearDistance()
        clears the first buffer
      • clearRange

        public void clearRange​(int x,
                               int y,
                               int r,
                               int round)
        Parameters:
        x -
        y -
        r -
        round -