can get to block at eye level adjacent too

This commit is contained in:
Leijurv 2018-09-07 10:50:49 -07:00
parent e51c729acb
commit 0d515b336f
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 4 additions and 1 deletions

View File

@ -50,6 +50,9 @@ public class GoalGetToBlock implements Goal {
if (yDiff == -2 && xDiff == 0 && zDiff == 0) { if (yDiff == -2 && xDiff == 0 && zDiff == 0) {
return true; return true;
} }
if (yDiff == -1) {
yDiff = 0;
}
return Math.abs(xDiff) + Math.abs(yDiff) + Math.abs(zDiff) <= 1; return Math.abs(xDiff) + Math.abs(yDiff) + Math.abs(zDiff) <= 1;
} }

View File

@ -30,7 +30,7 @@ public class GoalGetToBlockTest {
@Test @Test
public void isInGoal() { public void isInGoal() {
List<String> acceptableOffsets = new ArrayList<>(Arrays.asList("0,0,0", "0,0,1", "0,0,-1", "1,0,0", "-1,0,0", "0,1,0", "0,-1,0", "0,-2,0")); List<String> acceptableOffsets = new ArrayList<>(Arrays.asList("0,0,0", "0,0,1", "0,0,-1", "1,0,0", "-1,0,0", "0,-1,1", "0,-1,-1", "1,-1,0", "-1,-1,0", "0,1,0", "0,-1,0", "0,-2,0"));
for (int x = -10; x <= 10; x++) { for (int x = -10; x <= 10; x++) {
for (int y = -10; y <= 10; y++) { for (int y = -10; y <= 10; y++) {
for (int z = -10; z <= 10; z++) { for (int z = -10; z <= 10; z++) {