Kniffel/domain/Game.java

40 lines
762 B
Java
Raw Normal View History

package domain;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
public class Game {
private ArrayList<Player> currentPlayers;
private int turnPlayer;
private Dice dice;
public Game(){
currentPlayers = new ArrayList<Player>();
turnPlayer = 0;
dice = new Dice(6);
}
public void nextTurn(){
Collections.rotate(currentPlayers, -1);
}
public Player getCurrentPlayer(){
return currentPlayers.getFirst();
}
public int rollDice(){
return dice.roll();
}
public void addPlayer(Player playerToAdd){
currentPlayers.add(playerToAdd);
}
public ArrayList<Player> getPlayers(){
return currentPlayers;
}
}