icfp-model/src/main/java/ru/bosony/model/game/Game.java
changeset 27 505c25412b16
parent 25 d6a75f29ba9b
child 28 9c68562715ed
     1.1 --- a/icfp-model/src/main/java/ru/bosony/model/game/Game.java	Sun Jul 15 19:26:28 2012 +0400
     1.2 +++ b/icfp-model/src/main/java/ru/bosony/model/game/Game.java	Sun Jul 15 21:20:04 2012 +0400
     1.3 @@ -114,6 +114,20 @@
     1.4  				&& getContent(mine.getCell(nextRobotCoord.left())) == Empty) {
     1.5  			moveRobot(nextRobotCell);
     1.6  			mine.getCell(nextRobotCoord.left()).setContent(Rock);
     1.7 +		} else if (CellContent.getTrampolines().contains(nextRobotCellContent)
     1.8 +				&& CellContent.getTargets().contains(nextRobotCellContent.getTrampolineTarget())) {
     1.9 +			CellContent trampoline = nextRobotCellContent;
    1.10 +			CellContent target = trampoline.getTrampolineTarget();
    1.11 +			for (Cell targetCell : mine.findCells(target)) {
    1.12 +				moveRobot(targetCell);
    1.13 +			}
    1.14 +			for (CellContent tramp : CellContent.getTrampolines()) {
    1.15 +				if (tramp.getTrampolineTarget() == target) {
    1.16 +					for (Cell trampolineCell : mine.findCells(tramp)) {
    1.17 +						trampolineCell.setContent(Empty);
    1.18 +					}
    1.19 +				}
    1.20 +			}
    1.21  		} else {
    1.22  			mov = Movement.WAIT;
    1.23  		}