Added setEnemyID function

This commit is contained in:
Malte Tammena 2017-10-20 14:12:03 +02:00
parent fe765ec4a5
commit 1c78ba0113
3 changed files with 11 additions and 0 deletions

View file

@ -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);
}

View file

@ -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)) {

View file

@ -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) {