icfp-model/src/main/java/ru/bosony/model/game/Game.java
branchCleverSearch
changeset 50 9530f55e9639
parent 47 b3d48e364f9e
equal deleted inserted replaced
49:70cfa8a066df 50:9530f55e9639
    70 		// Score
    70 		// Score
    71 		int prevScore = score;
    71 		int prevScore = score;
    72 
    72 
    73 		// Moving and scoring
    73 		// Moving and scoring
    74 		route.add(mov);
    74 		route.add(mov);
    75 		try {
    75 		history.add(mine.clone());
    76 			history.add(mine.clone());
       
    77 		} catch (CloneNotSupportedException e) {
       
    78 			throw new RuntimeException(e);
       
    79 		}
       
    80 		Cell robotCell = mine.getRobotCell();
    76 		Cell robotCell = mine.getRobotCell();
    81 		Coordinate robotCoord = robotCell.getCoordinate();
    77 		Coordinate robotCoord = robotCell.getCoordinate();
    82 		Coordinate nextRobotCoord = null;
    78 		Coordinate nextRobotCoord = null;
    83 		switch (mov) {
    79 		switch (mov) {
    84 		case ABORT:
    80 		case ABORT:
   369 				return true;
   365 				return true;
   370 			state.put(mine, mov);
   366 			state.put(mine, mov);
   371 		}
   367 		}
   372 		return false;
   368 		return false;
   373 	}
   369 	}
       
   370 
       
   371 	@Override
       
   372 	public String toString() {
       
   373 		return state.toString() + ", score = " + score + ", " + route.size() + " steps: "
       
   374 				+ (route.size() > 100 ? getStringRoute().substring(0, 100) + "..." : getStringRoute()) + "\n\n" + mine;
       
   375 	}
   374 }
   376 }