blob: 35e9457c388185b177476dc58e89c3c0122509f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package jrummikub.model;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
/** Class managing the overall and momentary GameState */
public class GameState {
Table table;
List<Player> players;
int activePlayer;
private StoneHeap gameHeap;
public GameState() {
players = new ArrayList<Player>();
players.add(new Player(Color.red));
players.add(new Player(Color.yellow));
players.add(new Player(Color.green));
players.add(new Player(Color.black));
activePlayer = 0;
}
/** Changes the activePlayer to the next {@link Player} in the list */
public void nextPlayer() {
activePlayer = (activePlayer + 1) % 4;
}
public Player activePlayer() {
return players.get(activePlayer);
}
public StoneHeap getGameHeap() {
return gameHeap;
}
}
|