public void findPathFromStartToEnd(Position startPosition) { System.err.println("move " + getRoom(startPosition).getPosition()); Room actRoom = getRoom(startPosition).getNextRoom(); actRoom.setDistance(1); System.err.println("move " + actRoom.getPosition()); while (actRoom != getRoom(endPosition)) { Room nextRoom = actRoom.getNextRoom(); if (nextRoom == null || nextRoom.isBlocker()) { actRoom.setDistance(0); actRoom = actRoom.getPrev(); } else { nextRoom.setDistance(actRoom.getDistance() + 1); actRoom = nextRoom; } System.err.println("move " + actRoom.getPosition()); } actRoom = getRoom(startPosition).getNext(); while (actRoom != getRoom(endPosition) && actRoom.getRotation() == 0) { actRoom = actRoom.getNext(); } if (actRoom.isRotatable() && actRoom.getRotation() != 0) { rotationMap.put(actRoom.getDistance() - Math.abs(actRoom.getRotation()), actRoom); } }
public void compareRockPathWithIndisPath(Position rockPosition) { Room joinerRoom = getRoom(rockPosition).getActRoomTypeExitsNext(); while (joinerRoom != null && joinerRoom.getDistance() == 0) { joinerRoom.setDistance(joinerRoom.getPrev().getDistance() + 1); joinerRoom = joinerRoom.getActRoomTypeExitsNext(); } if (joinerRoom != null && joinerRoom.getDistance() == joinerRoom.getPrev().getDistance() + 1) { findSeparatorRoom(joinerRoom); } }