Alpha-Beta move generator can look 2 plays (4 plies) ahead on a 4x4 board and blocks every possible attempt by the player to connect 3.

It should be possible to play on larger boards when the computers 'move' is changed from playing a tile to picking the player's next available color.
This commit is contained in:
Woody Folsom
2012-04-14 15:36:02 -04:00
parent 74b8eb4622
commit d9ec72d0fb
23 changed files with 396 additions and 69 deletions

View File

@@ -0,0 +1,24 @@
package model;
/**
* Scorer for use by various ComPlayer implementations.
*
* @author Woody
*
*/
public class BoardScorer {
public int getMaxScore(Board board) {
return Board.NUM_ROWS * Board.NUM_COLS;
}
public int getScore(Board board) {
int score = 0;
for (int r = 0; r < Board.NUM_ROWS; r++) {
for (int c = 0; c < Board.NUM_COLS; c++) {
score += board.getTile(r, c) == Board.TileColor.NONE ? 0 : 1;
}
}
return score;
}
}