quoridor/src/main/java/cz/xelfi/quoridor/Player.java
changeset 34 34baf57f2d4e
parent 33 6a6d1dbea99e
child 264 d60370059c3c
     1.1 --- a/quoridor/src/main/java/cz/xelfi/quoridor/Player.java	Sat Jun 06 15:13:04 2009 +0200
     1.2 +++ b/quoridor/src/main/java/cz/xelfi/quoridor/Player.java	Sun Jul 12 13:35:58 2009 +0200
     1.3 @@ -118,5 +118,14 @@
     1.4          final boolean reached(Player p) {
     1.5              return p.getYInternal() == finalLine;
     1.6          }
     1.7 +
     1.8 +        static Direction valueOf(char ch) throws IllegalPositionException {
     1.9 +            for (Direction direction : values()) {
    1.10 +                if (direction.name().charAt(0) == ch) {
    1.11 +                    return direction;
    1.12 +                }
    1.13 +            }
    1.14 +            throw new IllegalPositionException("No direction " + ch);
    1.15 +        }
    1.16      }
    1.17  }