- Reorganized the constructors in Move.java.

- Made the getBoardState method in Referee.java static.
- Created NeuralNetworkPlayer.java, though I don't know how to make the computer use it.
- Updated the Player interface to include passing the PlayerModel. Most of the current com agents ignore the data, but it is now available.
- Updated the train function in PlayerModel.java.
This commit is contained in:
Marshall
2012-04-29 14:19:10 -04:00
parent a756aa242d
commit 60a842d729
10 changed files with 201 additions and 94 deletions

View File

@@ -3,19 +3,24 @@ package model.comPlayer;
import java.util.Random;
import model.Board;
import model.Board.TileColor;
import model.CellPointer;
import model.Move;
import model.Board.TileColor;
import model.playerModel.PlayerModel;
public class MonteCarloComPlayer implements Player {
private final Random rand = new Random();
@Override
public Move getMove(Board board) {
return getRandomMove(board,true);
public void denyMove() {
throw new UnsupportedOperationException("Not implemented");
}
@Override
public Move getMove(Board board, PlayerModel player) {
return getRandomMove(board, true);
}
public Move getRandomMove(Board board, boolean isCompTurn) {
TileColor tile = TileColor.BLUE;
int r = -1;
@@ -42,19 +47,14 @@ public class MonteCarloComPlayer implements Player {
tile = TileColor.YELLOW;
}
return new Move(new CellPointer(r, c), tile);
}
@Override
public void denyMove() {
throw new UnsupportedOperationException("Not implemented");
return new Move(tile, new CellPointer(r, c));
}
@Override
public boolean isReady() {
return true; // always ready to play a random valid move
}
@Override
public String toString() {
return "Monte Carlo ComPlayer";