1.1 --- a/quoridor/src/main/java/cz/xelfi/quoridor/Move.java Sun Jul 12 13:35:58 2009 +0200
1.2 +++ b/quoridor/src/main/java/cz/xelfi/quoridor/Move.java Thu Sep 10 23:19:40 2009 +0200
1.3 @@ -46,6 +46,10 @@
1.4 fence = f;
1.5 direction = null;
1.6 }
1.7 + private Move() {
1.8 + fence = null;
1.9 + direction = null;
1.10 + }
1.11
1.12 /** Moves the player's figure to north */
1.13 public static final Move NORTH = new Move(Direction.NORTH);
1.14 @@ -55,6 +59,8 @@
1.15 public static final Move SOUTH = new Move(Direction.SOUTH);
1.16 /** Moves the player's figure to west */
1.17 public static final Move WEST = new Move(Direction.WEST);
1.18 + /** Allows the player to resign the game */
1.19 + public static final Move RESIGN = new Move();
1.20
1.21 /** Places a fence into given position with specified orientation.
1.22 * The faces postions are numbered 1-8 and A-H according to following
1.23 @@ -139,6 +145,10 @@
1.24 case 'E': return Move.EAST;
1.25 case 'W': return Move.WEST;
1.26 }
1.27 + case 6:
1.28 + if ("RESIGN".equals(move)) {
1.29 + return Move.RESIGN;
1.30 + }
1.31 }
1.32 throw new IllegalPositionException(move);
1.33 }
1.34 @@ -152,6 +162,9 @@
1.35 }
1.36 throw new IllegalStateException();
1.37 } else {
1.38 + if (direction == null) {
1.39 + return "RESIGN"; // NOI18N
1.40 + }
1.41 StringBuilder sb = new StringBuilder();
1.42 for (Direction d : direction) {
1.43 sb.append(d.name().charAt(0));