1.1 --- a/quoridor/src/main/java/cz/xelfi/quoridor/Board.java Sun May 10 22:05:31 2009 +0200
1.2 +++ b/quoridor/src/main/java/cz/xelfi/quoridor/Board.java Sun May 10 22:17:10 2009 +0200
1.3 @@ -18,6 +18,8 @@
1.4 * http://www.gamerz.net/pbmserv/quoridor.html
1.5 * and shall be able to read that format back. The class is immutable
1.6 * but it contains "move operations" that produce new Board position.
1.7 + * <p>
1.8 + *
1.9 *
1.10 * @author Jaroslav Tulach
1.11 */
1.12 @@ -176,42 +178,6 @@
1.13 throw new IllegalPositionException ("Cannot use multi direction when there is not oponent pawn"); // NOI18N
1.14 }
1.15
1.16 - /** Places a fence into given position with specified orientation.
1.17 - * The faces postions are numbered 1-8 and A-H according to following
1.18 - * graph: <pre>
1.19 - H G F E D C B A
1.20 - | | | | | | | |
1.21 - +-----------------------------------+
1.22 - | |
1.23 - 1--| + + + + + + + + |--1
1.24 - | |
1.25 - 2--| + + + + + + + + |--2
1.26 - | |
1.27 - 3--| + + + + + + + + |--3
1.28 - | |
1.29 - 4--| + + + + + + + + |--4
1.30 -[E] | | [W]
1.31 - 5--| + + + + + + + + |--5
1.32 - | |
1.33 - 6--| + + + + + + + + |--6
1.34 - | |
1.35 - 7--| + + + + + + + + |--7
1.36 - | |
1.37 - 8--| + + + + + + + + |--8
1.38 - | |
1.39 - +-----------------------------------+
1.40 - | | | | | | | |
1.41 - H G F E D C B A
1.42 - * </pre>
1.43 - *
1.44 - *
1.45 - * @param player the player that wishes to place the position
1.46 - * @param x x-coordinate of the middle of the fence from 'A' to 'B'
1.47 - * @param y y-coordinate of the middle of the fence
1.48 - * @param orientation place the fence horizontally or vertically
1.49 - * @return the new board
1.50 - * @exception IllegalPositionException if the move is not possible
1.51 - */
1.52 final Board fence (Player player, char x, int y, Fence.Orientation orientation) throws IllegalPositionException {
1.53 return fence(player, new Fence ((x - 'A') * 2 + 1, y * 2 - 1, orientation));
1.54 }
2.1 --- a/quoridor/src/main/java/cz/xelfi/quoridor/Move.java Sun May 10 22:05:31 2009 +0200
2.2 +++ b/quoridor/src/main/java/cz/xelfi/quoridor/Move.java Sun May 10 22:17:10 2009 +0200
2.3 @@ -25,11 +25,50 @@
2.4 direction = null;
2.5 }
2.6
2.7 + /** Moves the player's figure to north */
2.8 public static final Move NORTH = new Move(Direction.NORTH);
2.9 + /** Moves the player's figure to east */
2.10 public static final Move EAST = new Move(Direction.EAST);
2.11 + /** Moves the player's figure to south */
2.12 public static final Move SOUTH = new Move(Direction.SOUTH);
2.13 + /** Moves the player's figure to west */
2.14 public static final Move WEST = new Move(Direction.WEST);
2.15
2.16 + /** Places a fence into given position with specified orientation.
2.17 + * The faces postions are numbered 1-8 and A-H according to following
2.18 + * graph: <pre>
2.19 + H G F E D C B A
2.20 + | | | | | | | |
2.21 + +-----------------------------------+
2.22 + | |
2.23 + 1--| + + + + + + + + |--1
2.24 + | |
2.25 + 2--| + + + + + + + + |--2
2.26 + | |
2.27 + 3--| + + + + + + + + |--3
2.28 + | |
2.29 + 4--| + + + + + + + + |--4
2.30 +[E] | | [W]
2.31 + 5--| + + + + + + + + |--5
2.32 + | |
2.33 + 6--| + + + + + + + + |--6
2.34 + | |
2.35 + 7--| + + + + + + + + |--7
2.36 + | |
2.37 + 8--| + + + + + + + + |--8
2.38 + | |
2.39 + +-----------------------------------+
2.40 + | | | | | | | |
2.41 + H G F E D C B A
2.42 + * </pre>
2.43 + *
2.44 + *
2.45 + * @param x x-coordinate of the middle of the fence from 'A' to 'B'
2.46 + * @param y y-coordinate of the middle of the fence
2.47 + * @param orientation place the fence horizontally or vertically
2.48 + * @return the new board
2.49 + * @exception IllegalPositionException if the move is not possible
2.50 + */
2.51 public static Move fence(char x, int y, Fence.Orientation orientation) throws IllegalPositionException {
2.52 if (x < 'A' || 'H' < x) {
2.53 throw new IllegalPositionException ("x coordinate has to be from A to H"); // NOI18N
2.54 @@ -37,6 +76,14 @@
2.55 return new Move(new Fence ((x - 'A') * 2 + 1, y * 2 - 1, orientation));
2.56 }
2.57
2.58 + /** Moves the player in given directions. After applying
2.59 + * the first direction, the pawn has to get on a position
2.60 + * that is occupied by other player's pawn.
2.61 + *
2.62 + * @param where one or two directions saying where
2.63 + * @return the new board
2.64 + * @exception IllegalPositionException if the move is not possible
2.65 + */
2.66 public static Move jump(Direction first, Direction second) {
2.67 return new Move(first, second);
2.68 }