FelixKrull
3 years ago
4 changed files with 109 additions and 18 deletions
-
43src/main/java/Game.java
-
7src/main/java/Player.java
-
63src/test/java/GameTest.java
-
14src/test/java/PlayerTest.java
@ -1,21 +1,48 @@ |
|||
import java.util.ArrayList; |
|||
|
|||
public class Game { |
|||
|
|||
Gameboard gb; |
|||
Player p1; |
|||
Player p2; |
|||
Player p3; |
|||
Player p4; |
|||
ArrayList<Player> players; |
|||
|
|||
public static void main(String[] args) { |
|||
Game g = new Game(); |
|||
/*while (checkDice() != 0) { |
|||
int dice = g.players[0].rollDice(); |
|||
System.out.println("Würfel: " + dice); |
|||
}*/ |
|||
} |
|||
|
|||
public Game() { |
|||
this.gb = new Gameboard(); |
|||
gb.initGameboard(); |
|||
p1 = new Player("Rot", 40, 43); |
|||
p2 = new Player("Blau", 44, 47); |
|||
p3 = new Player("Gelb", 48, 51); |
|||
p4 = new Player("Grün", 52, 55); |
|||
players = new ArrayList<>(); |
|||
players.add(new Player("Rot", 40, 43)); |
|||
players.add(new Player("Blau", 44, 47)); |
|||
players.add(new Player("Gelb", 48, 51)); |
|||
players.add(new Player("Grün", 52, 55)); |
|||
} |
|||
|
|||
public int checkDice(int dice, Player p) { |
|||
int figuresInBase = p.checkFigureInBase(p.figures); |
|||
if(figuresInBase == 4) { |
|||
if(dice == 6) { |
|||
return 1; |
|||
} else { |
|||
return 0; |
|||
} |
|||
} else if(figuresInBase > 0) { |
|||
if(dice == 6) { |
|||
return 3; |
|||
} else { |
|||
return 2; |
|||
} |
|||
} else { |
|||
if(dice == 6) { |
|||
return 5; |
|||
} else { |
|||
return 4; |
|||
} |
|||
} |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue