Minor changes to support debugging Alpha-Beta move generator.

This commit is contained in:
Woody Folsom
2012-04-25 09:27:52 -04:00
parent 10f43ee31c
commit b87f58cb31
12 changed files with 297 additions and 102 deletions

View File

@@ -8,8 +8,8 @@ public class Board {
BLUE, GREEN, NONE, RED, YELLOW
}
public static final int NUM_COLS = 4;
public static final int NUM_ROWS = 4;
public static final int NUM_COLS = 5;
public static final int NUM_ROWS = 5;
public static final int ROW_REMOVAL_SIZE = 3;
private final TileColor[][] board;
@@ -20,9 +20,9 @@ public class Board {
public Board(Board that) {
board = new TileColor[NUM_ROWS][NUM_COLS];
for (int i = 0; i < NUM_COLS; i++) {
for (int j = 0; j < NUM_ROWS; j++) {
this.board[j][i] = that.board[j][i];
for (int r = 0; r < NUM_ROWS; r++) {
for (int c = 0; c < NUM_COLS; c++) {
this.board[r][c] = that.board[r][c];
}
}
}
@@ -230,4 +230,18 @@ public class Board {
numPlies++;
return true;
}
@Override
public String toString() {
StringBuilder sb1 = new StringBuilder();
for (int r = 0; r < NUM_ROWS; r++) {
StringBuilder sb2 = new StringBuilder();
for (int c = 0; c < NUM_COLS; c++) {
sb2.append(board[r][c].toString().charAt(0));
}
sb1.append(sb2);
sb1.append("\n");
}
return sb1.toString();
}
}

View File

@@ -1,11 +1,18 @@
package model;
public class CellPointer {
public static final CellPointer NONE = new CellPointer(-1,-1);
public final int c;
public final int r;
public CellPointer(int row, int col) {
r = row;
c = col;
this.r = row;
this.c = col;
}
public int r;
public int c;
}
@Override
public String toString() {
return "(" + r + "," + c +")";
}
}

View File

@@ -28,4 +28,9 @@ public class Move {
public TileColor getColor() {
return color;
}
@Override
public String toString() {
return "Play " + color + "@" + cp;
}
}

View File

@@ -1,14 +1,16 @@
package model;
import model.Board.TileColor;
import org.apache.log4j.Logger;
import player.AlphaBetaComPlayer;
import player.HumanPlayer;
import player.MinimaxComPlayer;
import player.Player;
import view.BoardPanel;
import view.MessagePanel;
import view.ScorePanel;
import model.Board.TileColor;
public class Referee implements Runnable {

View File

@@ -0,0 +1,16 @@
package model;
public class SearchResult {
public final Move move;
public final int score;
public SearchResult(Move move, int score) {
this.move = move;
this.score = score;
}
@Override
public String toString() {
return move + ", score: " + score;
}
}