summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/model/GameState.java
blob: 23e51b46ea9191069f669006fc828c797c032de9 (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
37
38
39
40
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 {
	ITable table;
	List<Player> players;
	int activePlayer;
	private StoneHeap gameHeap;

	public GameState() {
		table = new Table();
		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;
	}

	public ITable getTable() {
		return table;
	}

	/** 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;
	}
}