Advertisement
aarono

MazeLayout Enumeration

Jan 24th, 2013
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.42 KB | None | 0 0
  1. import java.awt.Point;
  2. import java.util.ArrayList;
  3. import java.util.Arrays;
  4.  
  5. public enum MazeLayout
  6. {
  7.     Empty,
  8.     Basic;
  9.    
  10.     private final static Point[] PtsBasic =
  11.     {
  12.         new Point(1, 1),
  13.         new Point(1, 2),
  14.         new Point(1, 3),
  15.         new Point(1, 7),
  16.                
  17.         new Point(2, 3),
  18.         new Point(2, 7),
  19.         new Point(2, 8),
  20.         new Point(2, 9),
  21.                
  22.         new Point(3, 3),
  23.         new Point(3, 5),
  24.                
  25.         new Point(4, 3),
  26.         new Point(4, 5),
  27.                
  28.         new Point(5, 3),
  29.         new Point(5, 5),
  30.         new Point(5, 7),
  31.         new Point(5, 8),
  32.         new Point(5, 9),
  33.                
  34.         new Point(6, 5),
  35.         new Point(6, 9),
  36.                
  37.         new Point(7, 2),
  38.         new Point(7, 3),
  39.         new Point(7, 4),
  40.         new Point(7, 5),
  41.         new Point(7, 6),
  42.         new Point(7, 7),
  43.         new Point(7, 9),
  44.                
  45.         new Point(8, 9)
  46.     };
  47.    
  48.     public boolean hasWallAt(Point position)
  49.     {
  50.         ArrayList<Point> points;
  51.        
  52.         switch (ordinal())
  53.         {
  54.             case 1:
  55.                 points = new ArrayList<Point>(Arrays.asList(PtsBasic));
  56.                 break;
  57.             default:
  58.                 points = new ArrayList<Point>();
  59.                 break;
  60.         }
  61.        
  62.         return points.contains(position);
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement