Browse Source

Add AiPlayer

AIPlayer
FelixKrull 3 years ago
parent
commit
e09df4e89b
  1. 13
      src/main/java/AIPlayer.java
  2. 6
      src/main/java/Game.java

13
src/main/java/AIPlayer.java

@ -0,0 +1,13 @@
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) {
return (int) (Math.random() * usableFigures.size());
}
}

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

Loading…
Cancel
Save