Add some endOfTurn handling to RoundControl
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@155 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
0b66e7d763
commit
38f6f0dc24
6 changed files with 254 additions and 219 deletions
|
@ -60,6 +60,7 @@ public class RoundControl {
|
|||
endOfTurn();
|
||||
}
|
||||
});
|
||||
|
||||
turnControl.startTurn();
|
||||
}
|
||||
|
||||
|
@ -74,7 +75,27 @@ public class RoundControl {
|
|||
}
|
||||
|
||||
private void endOfTurn() {
|
||||
Set<Stone> tableDiff = tableDifference(gameState.getTable(), clonedTable);
|
||||
|
||||
if (!tableDiff.isEmpty()) { // Player has made a move
|
||||
if (clonedTable.isValid()) {
|
||||
gameState.setTable(clonedTable);
|
||||
|
||||
// TODO Win check
|
||||
} else {
|
||||
gameState.getGameHeap().putBack(tableDiff);
|
||||
dealPenalty(tableDiff.size());
|
||||
}
|
||||
} else { // Player hasn't made a move
|
||||
if (clonedTable.isValid()) {
|
||||
gameState.setTable(clonedTable);
|
||||
}
|
||||
|
||||
dealStone();
|
||||
}
|
||||
|
||||
gameState.nextPlayer();
|
||||
prepareTurn();
|
||||
}
|
||||
|
||||
static Set<Stone> tableDifference(ITable oldTable, ITable newTable) {
|
||||
|
@ -94,15 +115,12 @@ public class RoundControl {
|
|||
return ret;
|
||||
}
|
||||
|
||||
private void resetTable() {
|
||||
|
||||
}
|
||||
|
||||
private void preparePlayerTurn() {
|
||||
|
||||
}
|
||||
|
||||
private void dealStone() {
|
||||
// gameState.getActivePlayer().getHand().drop(object, position)
|
||||
}
|
||||
|
||||
private void dealPenalty(int count) {
|
||||
for (int i = 0; i < count + 3; ++i)
|
||||
dealStone();
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue