Added naming support in Player and subclasses
This commit is contained in:
parent
5abc51688b
commit
ae38e67a90
@ -28,6 +28,7 @@ public class NaturalPlayer extends Player implements MouseListener {
|
|||||||
public NaturalPlayer(Color color, OverlayComponent overlayComponent) {
|
public NaturalPlayer(Color color, OverlayComponent overlayComponent) {
|
||||||
super(color);
|
super(color);
|
||||||
this.overlayComponent = overlayComponent;
|
this.overlayComponent = overlayComponent;
|
||||||
|
name = "Player";
|
||||||
moveRequested = false;
|
moveRequested = false;
|
||||||
|
|
||||||
overlayComponent.addMouseListener(this);
|
overlayComponent.addMouseListener(this);
|
||||||
|
@ -14,6 +14,7 @@ public abstract class Player {
|
|||||||
protected Game game;
|
protected Game game;
|
||||||
protected Board board;
|
protected Board board;
|
||||||
protected Color color;
|
protected Color color;
|
||||||
|
protected String name;
|
||||||
|
|
||||||
public Player(Color color) {
|
public Player(Color color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
@ -39,4 +40,8 @@ public abstract class Player {
|
|||||||
public Color getColor() { return color; }
|
public Color getColor() { return color; }
|
||||||
|
|
||||||
public void setColor(Color color) { this.color = color; }
|
public void setColor(Color color) { this.color = color; }
|
||||||
|
|
||||||
|
public String getName() { return name; }
|
||||||
|
|
||||||
|
public void setName(String name) { this.name = name; }
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,6 @@ import dev.kske.chess.uci.UCIOption;
|
|||||||
public class UCIPlayer extends Player implements UCIListener {
|
public class UCIPlayer extends Player implements UCIListener {
|
||||||
|
|
||||||
private UCIHandle handle;
|
private UCIHandle handle;
|
||||||
|
|
||||||
private String name, author;
|
|
||||||
private List<UCIOption> options;
|
private List<UCIOption> options;
|
||||||
|
|
||||||
public UCIPlayer(Color color, String enginePath) {
|
public UCIPlayer(Color color, String enginePath) {
|
||||||
@ -57,11 +55,6 @@ public class UCIPlayer extends Player implements UCIListener {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onIdAuthor(String author) {
|
|
||||||
this.author = author;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUCIOk() {
|
public void onUCIOk() {
|
||||||
System.out.println("UCI ok");
|
System.out.println("UCI ok");
|
||||||
|
@ -32,6 +32,7 @@ public class AIPlayer extends Player {
|
|||||||
|
|
||||||
public AIPlayer(Color color, int maxDepth, int alphaBetaThreshold) {
|
public AIPlayer(Color color, int maxDepth, int alphaBetaThreshold) {
|
||||||
super(color);
|
super(color);
|
||||||
|
name = "AIPlayer";
|
||||||
availableProcessors = Runtime.getRuntime().availableProcessors();
|
availableProcessors = Runtime.getRuntime().availableProcessors();
|
||||||
this.maxDepth = maxDepth;
|
this.maxDepth = maxDepth;
|
||||||
this.alphaBetaThreshold = alphaBetaThreshold;
|
this.alphaBetaThreshold = alphaBetaThreshold;
|
||||||
|
Reference in New Issue
Block a user