Select Git revision
-
BATON Theau authoredBATON Theau authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
ComputerPlayer.java 1.21 KiB
package model;
import javafx.scene.paint.Color;
public class ComputerPlayer implements Player{
private String name;
private Cell cellStart;
private PlayStrategy strategi;
public ComputerPlayer(String name, Cell start){
this.name=name;
this.cellStart=start;
}
public ComputerPlayer(Cell start, PlayStrategy strategi){
this.name="player";
this.cellStart=start;
this.strategi=strategi;
}
public ComputerPlayer(String name, Cell start,PlayStrategy strategi){
this.name=name;
this.cellStart=start;
this.strategi= strategi;
}
@Override
public boolean isHuman() {
return false;
}
@Override
public void setName(String name) {
this.name = name;
}
@Override
public String getName() {
return this.name;
}
@Override
public Cell getStartCell() {
return this.cellStart;
}
public Color play(){
return this.strategi.play(this.getStartCell());// Color.RED;
}
public Color setStrategy(PlayStrategy strategy){
this.strategi=strategy;
return this.play();
}
public void setStartCell(Cell start){
this.cellStart=start;
}
}