diff --git a/src/main/java/AIPlayer.java b/src/main/java/AIPlayer.java new file mode 100644 index 0000000..f6aa6cb --- /dev/null +++ b/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 usableFigures) { + return (int) (Math.random() * usableFigures.size()); + } +} diff --git a/src/main/java/Game.java b/src/main/java/Game.java index 85d7a61..eb1c66e 100644 --- a/src/main/java/Game.java +++ b/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) {