Incremental updates. Work in progress to augment Board, Referee, add score for computer player, implement Monte-Carlo simulation.

Renamed Player implementations and changed Player to interface, with the goal of using abstraction to make the human and computer interactions with the game identical for ease of simulation.
This commit is contained in:
Woody Folsom
2012-04-08 17:25:10 -04:00
parent e0f42531e7
commit 9619f9a96d
13 changed files with 178 additions and 58 deletions

View File

@@ -1,8 +1,6 @@
package model;
import model.Board.TileColor;
import model.comController.RandomComController;
import controller.PlayerController;
public class Referee {
@@ -34,35 +32,33 @@ public class Referee {
}
private final Board board;
private final ComController cc;
private final PlayerController pc = new PlayerController();
private final HumanPlayer humanPlayer = new HumanPlayer();
private final Player cc;
private boolean playerTurn;
private int score = 0;
public Referee() {
board = new Board();
cc = new RandomComController(board);
cc = new RandomComPlayer();
playerTurn = true;
}
public void doSomething() {
if (playerTurn && pc.isReady()) {
Move mv = pc.getMove();
if (playerTurn && humanPlayer.isReady()) {
Move mv = humanPlayer.getMove(board);
if (board.getTile(mv.getCell().r, mv.getCell().c) == TileColor.NONE) {
playToken(pc.getMove());
playToken(humanPlayer.getMove(board));
} else {
pc.denyMove();
humanPlayer.denyMove();
}
} else if (!playerTurn) {
Move mv = cc.getMove();
Move mv = cc.getMove(board);
playToken(mv);
}
}
public ComController getCom() {
public Player getCom() {
return cc;
}
@@ -80,8 +76,8 @@ public class Referee {
}
}
public PlayerController getPlayer() {
return pc;
public HumanPlayer getHumanPlayer() {
return humanPlayer;
}
public int getScore() {