p1.adjustScore(trollPosition);
}
+ boolean FIX_IT() {
+ switch (league.fixLevel) {
+ case SOMETIMES: return random.nextInt(10) > 0;
+ case NEVER: return false;
+ default: throw new JavaLimitationError();
+ }
+ }
+
private Integer winner;
boolean haveWinner() {
return winner != null;
case Throw:
try { player.model.consumeStones(player.stoneThrow); }
catch (Model.Player.ThrewMoreStonesThanHad e) {
- boolean FIX_IT;
- switch (league.fixLevel) {
- case SOMETIMES:
- FIX_IT = model.random.nextInt(10) > 0;
- break;
- case NEVER:
- FIX_IT = false;
- break;
- default: throw new JavaLimitationError();
- }
- if (FIX_IT) {
+ if (model.FIX_IT()) {
player.view.threwMoreStonesThanHad();
player.stoneThrow = player.model.consumeMaxStones();
}
}
}
catch (Model.Player.FailedToThrowStonesAndShouldHave e) {
- boolean FIX_IT;
- switch (league.fixLevel) {
- case SOMETIMES:
- FIX_IT = model.random.nextInt(10) > 0;
- break;
- case NEVER:
- FIX_IT = false;
- break;
- default: throw new JavaLimitationError();
- }
- if (FIX_IT) {
+ if (model.FIX_IT()) {
player.view.failedToThrowStonesAndShouldHave();
player.stoneThrow = player.model.consumeMinStones();
}