diff --git a/src/main/java/evironment/antGame/Constants.java b/src/main/java/evironment/antGame/Constants.java index 2394491..cdc8040 100644 --- a/src/main/java/evironment/antGame/Constants.java +++ b/src/main/java/evironment/antGame/Constants.java @@ -3,4 +3,6 @@ package evironment.antGame; public class Constants { public static final int DEFAULT_GRID_WIDTH = 5; public static final int DEFAULT_GRID_HEIGHT = 5; + public static final int START_X = 5; + public static final int START_Y = 2; } diff --git a/src/main/java/evironment/antGame/Grid.java b/src/main/java/evironment/antGame/Grid.java index 28ae0e5..fcbc545 100644 --- a/src/main/java/evironment/antGame/Grid.java +++ b/src/main/java/evironment/antGame/Grid.java @@ -16,6 +16,7 @@ public class Grid { this.height = height; grid = new Cell[width][height]; initialGrid = new Cell[width][height]; + start = new Point(Constants.START_X, Constants.START_Y); initRandomWorld(); } @@ -29,10 +30,11 @@ public class Grid { initialGrid[x][y] = new Cell(new Point(x, y), CellType.FREE); } } - start = new Point(RNG.getEnvRandom().nextInt(width), RNG.getEnvRandom().nextInt(height)); - initialGrid[start.x][start.y] = new Cell(new Point(start.x, start.y), CellType.START); spawnNewFood(initialGrid); spawnObstacles(); + initialGrid[start.x][start.y] = new Cell(new Point(start.x, start.y), CellType.START); + ; + } //TODO @@ -53,7 +55,7 @@ public class Grid { /** * Spawns one additional food on a random field EXCEPT for the starting position */ - public void spawnNewFood(Cell[][] grid) { + private void spawnNewFood(Cell[][] grid) { boolean foodSpawned = false; Point potFood = new Point(0, 0); CellType potFieldType;