summaryrefslogtreecommitdiffstats
path: root/src/jrummikub
diff options
context:
space:
mode:
authorIda Massow <massow@informatik.uni-luebeck.de>2011-05-03 19:56:01 +0200
committerIda Massow <massow@informatik.uni-luebeck.de>2011-05-03 19:56:01 +0200
commite7613bfd930290025b4c5abaf4acf63683efd5f2 (patch)
tree9e91a6d7c93cbe9ecab4af76f3c39a546369c420 /src/jrummikub
parent2f4f2f79aed8752bd2164d0677e042716843304a (diff)
downloadJRummikub-e7613bfd930290025b4c5abaf4acf63683efd5f2.tar
JRummikub-e7613bfd930290025b4c5abaf4acf63683efd5f2.zip
Nochmal: GameState fertig und getestet, diesmal richtig
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@93 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src/jrummikub')
-rw-r--r--src/jrummikub/model/GameState.java20
-rw-r--r--src/jrummikub/model/Player.java12
2 files changed, 27 insertions, 5 deletions
diff --git a/src/jrummikub/model/GameState.java b/src/jrummikub/model/GameState.java
index 17b3ed0..35e9457 100644
--- a/src/jrummikub/model/GameState.java
+++ b/src/jrummikub/model/GameState.java
@@ -1,26 +1,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 {
- private Table table;
- private List<Player> players;
- private int activePlayer;
+ Table table;
+ List<Player> players;
+ int activePlayer;
private StoneHeap gameHeap;
public GameState() {
- this.players=new ArrayList<Player>();
+ 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;
}
}
diff --git a/src/jrummikub/model/Player.java b/src/jrummikub/model/Player.java
index 356b844..5e582ec 100644
--- a/src/jrummikub/model/Player.java
+++ b/src/jrummikub/model/Player.java
@@ -4,10 +4,22 @@ import java.awt.Color;
/** Class managing player data. No methods in release 1 */
public class Player {
+ public Player(Color color) {
+ this.color = color;
+ }
+
private Hand hand;
private Color color;
+ public Hand getHand() {
+ return hand;
+ }
+
+ public Color getColor() {
+ return color;
+ }
+
// private String name;
}