diff --git a/Makefile b/Makefile index 251c2f2..8015138 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ src/game/GameHistory.java \ src/game/GameEntry.java \ src/game/PlayerObject.java \ src/player/Player.java \ +src/player/Human.java \ src/player/malte/MalteAI.java \ src/player/malte/Pattern.java \ src/player/malte/Item.java \ @@ -30,13 +31,15 @@ BUILDFILES=$(OBJECTS) $(FXMLS_BUILD) MAIN=game.Main N=100 +P1= +P2= all: $(CLASSES) $(FXMLS_BUILD) $(JAVAC) $(JAVAC_OPTIONS) -cp $(CLASSPATH) $(CLASSES) -d $(BUILDS) run: $(CLASSES) - $(JAVA) -cp $(BUILDS) $(MAIN) + $(JAVA) -cp $(BUILDS) $(MAIN) $(P1) $(P2) simulate: $(CLASSES) $(JAVA) -cp $(BUILDS) $(MAIN) $(N) diff --git a/src/game/Main.java b/src/game/Main.java index 69c5bb6..fa21344 100644 --- a/src/game/Main.java +++ b/src/game/Main.java @@ -1,17 +1,43 @@ package game; import player.Player; +import player.Human; import player.maurizio.MaurizioAI; import player.malte.MalteAI; public class Main { public static void main(String[] args) { - if (args.length == 1) { + Player p1, p2; + if (args.length == 2) { + switch (args[0].toLowerCase()) { + case "maurizio": + p1 = new MaurizioAI("Maurizio"); + break; + case "human": + p1 = new Human(); + break; + case "malte": + default: + p1 = new MalteAI("Malte"); + } + switch (args[1].toLowerCase()) { + case "malte": + p2 = new MalteAI("Malte"); + break; + case "human": + p2 = new Human(); + break; + case "maurizio": + default: + p2 = new MaurizioAI("Maurizio"); + } + new Game(p1, p2).start(true, true); //1. param = output mode, 2. param = random beginner + } else if (args.length == 1) { Game.simulate(Integer.parseInt(args[0])); } else { - Player p1 = new MalteAI("Malte"); - Player p2 = new MaurizioAI("Maurizio"); + p1 = new MalteAI("Malte"); + p2 = new MaurizioAI("Maurizio"); new Game(p1, p2).start(true, true); //1. param = output mode, 2. param = random beginner } } diff --git a/src/player/Human.java b/src/player/Human.java new file mode 100644 index 0000000..9263c36 --- /dev/null +++ b/src/player/Human.java @@ -0,0 +1,38 @@ +package player; + +import java.util.Scanner; + +public class Human implements Player { + + private Scanner sc; + private int id; + private int enemyID; + private String name; + + public Human() { + sc = new Scanner(System.in); + System.out.print("Bitte gib deinen Namen ein: "); + this.name = sc.nextLine(); + } + + @Override + public int move(int[][] board) { + System.out.print("Choose a move: "); + return sc.nextInt(); + } + + @Override + public void setPlayerID(int id) { + this.id = id; + } + + @Override + public void setEnemyID(int enemyID) { + this.enemyID = enemyID; + } + + @Override + public String getName() { + return this.name; + } +}