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.
24 lines
456 B
Java
24 lines
456 B
Java
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;
|
|
}
|
|
} |