Added setEnemyID function
This commit is contained in:
parent
fe765ec4a5
commit
1c78ba0113
|
@ -5,4 +5,5 @@ public interface Player {
|
|||
public int move(int[][] game);
|
||||
public String getName();
|
||||
public void setPlayerID(int id);
|
||||
public void setEnemyID(int id);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ public class MalteAI implements Player{
|
|||
private String name;
|
||||
private Random ran;
|
||||
private int id;
|
||||
private int enemyID;
|
||||
|
||||
public MalteAI(String name){
|
||||
this.name = name;
|
||||
|
@ -22,6 +23,10 @@ public class MalteAI implements Player{
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public void setEnemyID(int id) {
|
||||
this.enemyID = enemyID;
|
||||
}
|
||||
|
||||
public int move(int[][] board){
|
||||
Set<Integer> options = new HashSet<>(Arrays.asList(0,1,2,3,4,5,6));
|
||||
for (Integer i: copySet(options)) {
|
||||
|
|
|
@ -9,6 +9,7 @@ public class MaurizioAI implements Player {
|
|||
private String name;
|
||||
private Random ran;
|
||||
private int id;
|
||||
private int enemyID;
|
||||
|
||||
public MaurizioAI(String name){
|
||||
this.name = name;
|
||||
|
@ -19,6 +20,10 @@ public class MaurizioAI implements Player {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
public void setEnemyID(int id) {
|
||||
this.enemyID = id;
|
||||
}
|
||||
|
||||
public int move(int[][] board){
|
||||
int choice = ran.nextInt(7);
|
||||
while (board[choice][0] != 0) {
|
||||
|
|
Loading…
Reference in a new issue