2024-04-29 21:06:04 +02:00
|
|
|
package domain;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
2024-05-04 21:06:05 +02:00
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collections;
|
2024-04-29 21:06:04 +02:00
|
|
|
|
|
|
|
public class Game {
|
2024-04-30 12:46:42 +02:00
|
|
|
private ArrayList<Player> currentPlayers;
|
|
|
|
private int turnPlayer;
|
|
|
|
private Dice dice;
|
2024-04-29 21:06:04 +02:00
|
|
|
|
|
|
|
public Game(){
|
|
|
|
currentPlayers = new ArrayList<Player>();
|
2024-04-30 12:46:42 +02:00
|
|
|
turnPlayer = 0;
|
2024-05-04 21:06:05 +02:00
|
|
|
dice = new Dice(8);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void nextTurn(){
|
|
|
|
Collections.rotate(currentPlayers, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Player getCurrentPlayer(){
|
|
|
|
return currentPlayers.getFirst();
|
2024-04-30 12:46:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public int rollDice(){
|
|
|
|
return dice.roll();
|
2024-04-29 21:06:04 +02:00
|
|
|
}
|
|
|
|
|
2024-05-04 21:06:05 +02:00
|
|
|
|
2024-04-29 21:06:04 +02:00
|
|
|
public void addPlayer(Player playerToAdd){
|
|
|
|
currentPlayers.add(playerToAdd);
|
|
|
|
}
|
2024-04-30 12:46:42 +02:00
|
|
|
|
|
|
|
public ArrayList<Player> getPlayers(){
|
|
|
|
return currentPlayers;
|
|
|
|
}
|
2024-04-29 21:06:04 +02:00
|
|
|
}
|