icfp-model/src/main/java/ru/bosony/model/game/Game.java
changeset 27 505c25412b16
parent 25 d6a75f29ba9b
child 28 9c68562715ed
equal deleted inserted replaced
26:964aa8102804 27:505c25412b16
   112 			mine.getCell(nextRobotCoord.right()).setContent(Rock);
   112 			mine.getCell(nextRobotCoord.right()).setContent(Rock);
   113 		} else if (robotCoord.left().equals(nextRobotCoord) && nextRobotCellContent == Rock
   113 		} else if (robotCoord.left().equals(nextRobotCoord) && nextRobotCellContent == Rock
   114 				&& getContent(mine.getCell(nextRobotCoord.left())) == Empty) {
   114 				&& getContent(mine.getCell(nextRobotCoord.left())) == Empty) {
   115 			moveRobot(nextRobotCell);
   115 			moveRobot(nextRobotCell);
   116 			mine.getCell(nextRobotCoord.left()).setContent(Rock);
   116 			mine.getCell(nextRobotCoord.left()).setContent(Rock);
       
   117 		} else if (CellContent.getTrampolines().contains(nextRobotCellContent)
       
   118 				&& CellContent.getTargets().contains(nextRobotCellContent.getTrampolineTarget())) {
       
   119 			CellContent trampoline = nextRobotCellContent;
       
   120 			CellContent target = trampoline.getTrampolineTarget();
       
   121 			for (Cell targetCell : mine.findCells(target)) {
       
   122 				moveRobot(targetCell);
       
   123 			}
       
   124 			for (CellContent tramp : CellContent.getTrampolines()) {
       
   125 				if (tramp.getTrampolineTarget() == target) {
       
   126 					for (Cell trampolineCell : mine.findCells(tramp)) {
       
   127 						trampolineCell.setContent(Empty);
       
   128 					}
       
   129 				}
       
   130 			}
   117 		} else {
   131 		} else {
   118 			mov = Movement.WAIT;
   132 			mov = Movement.WAIT;
   119 		}
   133 		}
   120 
   134 
   121 		// World changes
   135 		// World changes