Added naming support in Player and subclasses

This commit is contained in:
Kai S. K. Engelbart 2019-07-26 16:14:22 +02:00
parent 20ccb2aeef
commit 6d85a01fc2
Signed by: kske
GPG Key ID: 8BEB13EC5DF7EF13
4 changed files with 11 additions and 11 deletions

View File

@ -28,6 +28,7 @@ public class NaturalPlayer extends Player implements MouseListener {
public NaturalPlayer(Color color, OverlayComponent overlayComponent) {
super(color);
this.overlayComponent = overlayComponent;
name = "Player";
moveRequested = false;
overlayComponent.addMouseListener(this);

View File

@ -11,9 +11,10 @@ import dev.kske.chess.board.Piece.Color;
*/
public abstract class Player {
protected Game game;
protected Board board;
protected Color color;
protected Game game;
protected Board board;
protected Color color;
protected String name;
public Player(Color color) {
this.color = color;
@ -39,4 +40,8 @@ public abstract class Player {
public Color getColor() { return color; }
public void setColor(Color color) { this.color = color; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
}

View File

@ -19,9 +19,7 @@ import dev.kske.chess.uci.UCIOption;
*/
public class UCIPlayer extends Player implements UCIListener {
private UCIHandle handle;
private String name, author;
private UCIHandle handle;
private List<UCIOption> options;
public UCIPlayer(Color color, String enginePath) {
@ -57,11 +55,6 @@ public class UCIPlayer extends Player implements UCIListener {
this.name = name;
}
@Override
public void onIdAuthor(String author) {
this.author = author;
}
@Override
public void onUCIOk() {
System.out.println("UCI ok");

View File

@ -32,6 +32,7 @@ public class AIPlayer extends Player {
public AIPlayer(Color color, int maxDepth, int alphaBetaThreshold) {
super(color);
name = "AIPlayer";
availableProcessors = Runtime.getRuntime().availableProcessors();
this.maxDepth = maxDepth;
this.alphaBetaThreshold = alphaBetaThreshold;