aboutsummaryrefslogtreecommitdiff
path: root/Week6 Sliding game solver/src/Direction.java
blob: d4837b9127b20a2db1f900b45dcabc37e5766bc4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
 * @author Sjaak Smetsers
 * @version 1.2
 * @date 28-02-2015
 * An enumeration type for the 4 points of the compass 
 * Each constant has 2 (final) int attributes indicating
 * the displacement of each direction on a 2-dimensional grid 
 * of which the origin is located in the upper left corner
 */
public enum Direction {
    NORTH (0,-1), EAST (1,0), SOUTH(0,1), WEST(-1,0);
    
    private final int dx, dy;
    private Direction (int dx, int dy) {
        this.dx = dx;
        this.dy = dy;
    }
    
    public int GetDX () {
        return dx;
    }

    public int GetDY () {
        return dy;
    }
}