diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-10 05:53:30 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-05-10 05:53:30 +0200 |
commit | 32d07341a5399f83968c698bb0fac3d8349caf57 (patch) | |
tree | b6f93f54f27c88093cc145b9085192f87e34d20b /src/jrummikub/model | |
parent | 8f47c06e3175e7b2a6b0c27c96c0ed4d950b8ead (diff) | |
download | JRummikub-32d07341a5399f83968c698bb0fac3d8349caf57.tar JRummikub-32d07341a5399f83968c698bb0fac3d8349caf57.zip |
Define hand size constants in model
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@225 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/model')
-rw-r--r-- | src/jrummikub/model/Hand.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/jrummikub/model/Hand.java b/src/jrummikub/model/Hand.java index 8864a17..62531f4 100644 --- a/src/jrummikub/model/Hand.java +++ b/src/jrummikub/model/Hand.java @@ -6,6 +6,14 @@ import static jrummikub.model.StoneTray.Direction.*; /** Class managing a {@link Player}'s {@link Stone}s */ public class Hand extends StoneTray<Stone> implements IHand { + /** + * The width of the hand + */ + public final static int WIDTH = 14; + /** + * The height of the hand + */ + public final static int HEIGHT = 2; @Override protected Pair<Position, Direction> fixInvalidDrop(Stone stone, Position pos, @@ -13,20 +21,20 @@ public class Hand extends StoneTray<Stone> implements IHand { float x = pos.getX(); float y = pos.getY(); - if (x >= 0 && x <= 13) { + if (x >= 0 && x <= WIDTH - 1) { return null; } if (x < 0) { if (y == 0) { return new Pair<Position, Direction>(new Position(0, 0), RIGHT); } else { - return new Pair<Position, Direction>(new Position(13, 0), LEFT); + return new Pair<Position, Direction>(new Position(WIDTH - 1, 0), LEFT); } } else { if (y == 0) { return new Pair<Position, Direction>(new Position(0, 1), RIGHT); } else { - return new Pair<Position, Direction>(new Position(13, 1), LEFT); + return new Pair<Position, Direction>(new Position(WIDTH - 1, 1), LEFT); } } } |