diff --git a/GOLAD/AI.class b/GOLAD/AI.class index 81b892d..a6d2a03 100644 Binary files a/GOLAD/AI.class and b/GOLAD/AI.class differ diff --git a/GOLAD/AI.java b/GOLAD/AI.java index b0b4ba0..d9f10ed 100644 --- a/GOLAD/AI.java +++ b/GOLAD/AI.java @@ -6,21 +6,26 @@ import java.util.concurrent.Future; import java.util.ArrayList; class AI implements Callable { - private Tile[][] allTiles = new Tile[20][20]; + private Tile[][] allTiles = new Tile[0][0]; private final int depth; private ArrayList reds = new ArrayList(); ArrayList blues = new ArrayList(); private final boolean redTurn; private final boolean blueTurn; private final MyWorld w; + private final int WIDTH; + private final int HEIGHT; public AI(Tile[][] board, int depth,boolean redTurn, boolean blueTurn, MyWorld world){ - for(int i=0;i<20;i++){ - for(int j=0;j<20;j++){ + WIDTH = board.length; + HEIGHT = board[0].length; + allTiles = new Tile[WIDTH][HEIGHT]; + for(int i=0;i survive = new ArrayList<>(Arrays.asList(2,3)); ArrayList reds = new ArrayList(); ArrayList blues = new ArrayList(); - Tile[][] allTiles = new Tile[20][20]; + int WIDTH=20; + int HEIGHT=20; + Tile[][] allTiles = new Tile[WIDTH][HEIGHT]; boolean redTurn = true; boolean blueTurn = false; //int redMoves = 1; @@ -163,8 +165,8 @@ public void mainMenu(){ screen = 0; } public void createGrid(){ - for(int x = 0; x < 20; x++){ - for(int y = 0; y < 20; y++){ + for(int x = 0; x < WIDTH; x++){ + for(int y = 0; y < HEIGHT; y++){ Tile toAdd = new Tile(this, x, y); allTiles[x][y]=toAdd; addObject(toAdd, 30*x+15, 30*y+15); @@ -247,10 +249,10 @@ public void doTurn(){ doneTurn = false; } public void randomizeGrid(){ - for(int x = 0; x<10; x++){ - for(int y = 0; y<20; y++){ + for(int x = 0; x<(WIDTH/2); x++){ + for(int y = 0; y