- 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:
@@ -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";
|
||||
|
||||
Reference in New Issue
Block a user