Now generating primitive islands.

Favourable island mapper values.
This commit is contained in:
2020-05-01 18:37:06 -05:00
parent e4597538b2
commit a6cebe703b
7 changed files with 184 additions and 26 deletions

View File

@@ -1,6 +1,7 @@
package ca.recrown.islandsurvivalcraft.world;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Random;
@@ -29,11 +30,11 @@ public class IslandWorldMapperTest {
answers[x][y] = mapper.getWorldValue(x, y);
}
}
blockValCache.clearCache();
}
@AfterEach
public void individualCleanup() {
random.setSeed(SEED);
blockValCache.clearCache();
}
@@ -60,4 +61,15 @@ public class IslandWorldMapperTest {
assertEquals(answers[x][y], mapper.getWorldValue(x, y), String.format("Occurred at (%d, %d)", x, y));
}
}
@Test
public void test2048ValuesValidity() {
for (int i = 0; i < 1024; i++) {
int x = random.nextInt();
int y = random.nextInt();
assertTrue((mapper.getWorldValue(x, y) <= 1));
assertTrue((mapper.getWorldValue(x, y) >= -1));
}
}
}