- Reorganized packages so that the computer agents are inside the model package.
- Added support for the player model inside Referee.java; high scores should now persist over a single execution of the program. - Refactored PlayerModel.java to support game logging. All games are now logged so that we can track overall progress. - Added scaffolding to allow saving and importing of PlayerModel.java. It is not yet functional, but it will be with two function implementations and then the appropriate calls.
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package model;
|
||||
|
||||
import model.Board.TileColor;
|
||||
import model.comPlayer.AlphaBetaComPlayer;
|
||||
import model.comPlayer.HumanPlayer;
|
||||
import model.comPlayer.Player;
|
||||
import model.playerModel.PlayerModel;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import player.AlphaBetaComPlayer;
|
||||
import player.HumanPlayer;
|
||||
import player.Player;
|
||||
import view.BoardPanel;
|
||||
import view.HighScoreDialog;
|
||||
import view.MainFrame;
|
||||
@@ -27,10 +27,18 @@ public class Referee implements Runnable {
|
||||
private Player computerPlayer;
|
||||
|
||||
private final HumanPlayer humanPlayer = new HumanPlayer();
|
||||
|
||||
private final MainFrame mf;
|
||||
private final PlayerModel playerModel;
|
||||
|
||||
public Referee(MainFrame mnFrm) {
|
||||
if (PlayerModel.TRY_LOAD && PlayerModel.exists()) {
|
||||
playerModel = PlayerModel.load();
|
||||
}
|
||||
|
||||
else {
|
||||
playerModel = new PlayerModel();
|
||||
}
|
||||
|
||||
mf = mnFrm;
|
||||
initGame();
|
||||
}
|
||||
@@ -75,7 +83,8 @@ public class Referee implements Runnable {
|
||||
initGame();
|
||||
mf.updateBoard();
|
||||
play();
|
||||
new HighScoreDialog(mf, new PlayerModel());
|
||||
playerModel.logGame(getPlayerScore());
|
||||
new HighScoreDialog(mf, playerModel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user