summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control/turn
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-06-20 04:39:54 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-06-20 04:39:54 +0200
commit74d8205f30732a8afd6aa45f859188b0a3d447e5 (patch)
treeee84072fa43cf0342c4d5eb59e232d8c5b4b1802 /src/jrummikub/control/turn
parent477e8e9b82d6bcbec006914a22e05a2c18492869 (diff)
downloadJRummikub-74d8205f30732a8afd6aa45f859188b0a3d447e5.tar
JRummikub-74d8205f30732a8afd6aa45f859188b0a3d447e5.zip
Kommentare, Kommentare
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@509 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub/control/turn')
-rw-r--r--src/jrummikub/control/turn/AIControl.java16
-rw-r--r--src/jrummikub/control/turn/ITurnControl.java22
2 files changed, 24 insertions, 14 deletions
diff --git a/src/jrummikub/control/turn/AIControl.java b/src/jrummikub/control/turn/AIControl.java
index ba222ea..8bcf661 100644
--- a/src/jrummikub/control/turn/AIControl.java
+++ b/src/jrummikub/control/turn/AIControl.java
@@ -21,6 +21,9 @@ import jrummikub.util.Pair;
*/
public class AIControl extends AbstractTurnControl {
private TurnLogic logic;
+ /**
+ * Does the AI control currently use an internal timer
+ */
public static boolean useBackgroundThread = true;
long startTime;
@@ -63,7 +66,7 @@ public class AIControl extends AbstractTurnControl {
turnDone = true;
super.cleanUp();
}
-
+
@Override
public void abortTurn() {
aborted = true;
@@ -160,8 +163,8 @@ public class AIControl extends AbstractTurnControl {
for (StoneSet set : result) {
turnInfo.getTable().drop(
set,
- new Position(10 * (Math.random() * 2 - 1),
- 5 * (Math.random() * 2 - 1)));
+ new Position(10 * (Math.random() * 2 - 1), 5 * (Math
+ .random() * 2 - 1)));
for (Stone stone : set) {
turnInfo.getHand().pickUp(stone);
}
@@ -173,10 +176,11 @@ public class AIControl extends AbstractTurnControl {
private void doNotMoveExistingSets(List<StoneSet> result) {
- outerLoop: for (Iterator<Pair<StoneSet, Position>> it = turnInfo.getTable()
- .iterator(); it.hasNext();) {
+ outerLoop: for (Iterator<Pair<StoneSet, Position>> it = turnInfo
+ .getTable().iterator(); it.hasNext();) {
Pair<StoneSet, Position> pair = it.next();
- setSearch: for (Iterator<StoneSet> it2 = result.iterator(); it2.hasNext();) {
+ setSearch: for (Iterator<StoneSet> it2 = result.iterator(); it2
+ .hasNext();) {
StoneSet set = it2.next();
if (set.getSize() != pair.getFirst().getSize()) {
continue;
diff --git a/src/jrummikub/control/turn/ITurnControl.java b/src/jrummikub/control/turn/ITurnControl.java
index 1860d69..66bd065 100644
--- a/src/jrummikub/control/turn/ITurnControl.java
+++ b/src/jrummikub/control/turn/ITurnControl.java
@@ -16,12 +16,12 @@ public interface ITurnControl {
* Start the turn
*
* @param info
- * the current turn state
+ * the current turn state
*
* @param settings
- * the game settings
+ * the game settings
* @param view
- * view for user interaction.
+ * view for user interaction.
*/
public void setup(TurnInfo info, GameSettings settings, IView view);
@@ -49,10 +49,16 @@ public interface ITurnControl {
*/
public void abortTurn();
+ /**
+ * Emitted in network when the table changes during player turn
+ *
+ * @return the event
+ */
public IEvent1<ITable> getTableUpdateEvent();
/**
- * The TurnInfo class encapsulates all information concerning the current turn
+ * The TurnInfo class encapsulates all information concerning the current
+ * turn
*/
public class TurnInfo {
private ITable table;
@@ -64,13 +70,13 @@ public interface ITurnControl {
* Creates a new TurnInfo instance
*
* @param table
- * the current table
+ * the current table
* @param hand
- * the current player's hand
+ * the current player's hand
* @param hasLaidOut
- * has the player laid out yet?
+ * has the player laid out yet?
* @param turnMode
- * the turn mode
+ * the turn mode
*/
public TurnInfo(ITable table, IHand hand, boolean hasLaidOut,
TurnMode turnMode) {