Compare commits

...

6 Commits

  1. 14
      src/main/java/AIPlayer.java
  2. 6
      src/main/java/Game.java
  3. 6
      src/test/java/GameTest.java

14
src/main/java/AIPlayer.java

@ -0,0 +1,14 @@
import java.util.ArrayList;
public class AIPlayer extends Player{
public AIPlayer(String name, int startPos, int startHome, int jumpToHome) {
super(name, startPos, startHome, jumpToHome);
}
@Override
public int choose(ArrayList<Integer> usableFigures) {
int res = (int) ((Math.random() * usableFigures.size()));
return usableFigures.get(res);
}
}

6
src/main/java/Game.java

@ -48,9 +48,9 @@ public class Game {
gb.initGameboard();
players = new ArrayList<>();
players.add(new Player("Rot",0, 40, 39));
players.add(new Player("Blau",10, 44, 9));
players.add(new Player("Gelb",20, 48, 19));
players.add(new Player("Grün",30, 52, 29));
players.add(new AIPlayer("Blau",10, 44, 9));
players.add(new AIPlayer("Gelb",20, 48, 19));
players.add(new AIPlayer("Grün",30, 52, 29));
}
public String printGameboard(Game g, Player p, int dice) {

6
src/test/java/GameTest.java

@ -87,6 +87,12 @@ public class GameTest {
5,
1,
true
),
Arguments.of("Figures on Field - d: 6 - c: 1",
Arrays.asList(0, -1, -1, -1),
6,
3,
true
)
);
}

Loading…
Cancel
Save