Fixing scores and coordinates
authorindvdum (gotoindvdum[at]gmail[dot]com)
Sun, 15 Jul 2012 04:40:38 +0400
changeset 23606bba9825c8
parent 22 a46d0179df7a
child 24 46c2179854dc
Fixing scores and coordinates
icfp-model/src/main/java/ru/bosony/model/game/Game.java
     1.1 --- a/icfp-model/src/main/java/ru/bosony/model/game/Game.java	Sun Jul 15 04:09:14 2012 +0400
     1.2 +++ b/icfp-model/src/main/java/ru/bosony/model/game/Game.java	Sun Jul 15 04:40:38 2012 +0400
     1.3 @@ -62,7 +62,6 @@
     1.4  
     1.5  		// Score
     1.6  		int prevScore = score;
     1.7 -		score--;
     1.8  
     1.9  		// Moving and scoring
    1.10  		route.add(mov);
    1.11 @@ -90,6 +89,7 @@
    1.12  			nextRobotCoord = robotCoord.down();
    1.13  			break;
    1.14  		}
    1.15 +		score--;
    1.16  		Cell nextRobotCell = mine.getCell(nextRobotCoord);
    1.17  		CellContent nextRobotCellContent = getContent(nextRobotCell);
    1.18  		if (nextRobotCellContent == Empty || nextRobotCellContent == Earth) {
    1.19 @@ -105,11 +105,11 @@
    1.20  			lastScoreChange = score - prevScore;
    1.21  			state = GameState.Win;
    1.22  			return state;
    1.23 -		} else if (robotCoord.right() == nextRobotCoord && nextRobotCellContent == Rock
    1.24 +		} else if (robotCoord.right().equals(nextRobotCoord) && nextRobotCellContent == Rock
    1.25  				&& getContent(mine.getCell(nextRobotCoord.right())) == Empty) {
    1.26  			moveRobot(nextRobotCell);
    1.27  			mine.getCell(nextRobotCoord.right()).setContent(Rock);
    1.28 -		} else if (robotCoord.left() == nextRobotCoord && nextRobotCellContent == Rock
    1.29 +		} else if (robotCoord.left().equals(nextRobotCoord) && nextRobotCellContent == Rock
    1.30  				&& getContent(mine.getCell(nextRobotCoord.left())) == Empty) {
    1.31  			moveRobot(nextRobotCell);
    1.32  			mine.getCell(nextRobotCoord.left()).setContent(Rock);