summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-05-05 16:56:35 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-05-05 16:56:35 +0200
commit63ffedd7b0ecfbf690551b0e2fefac3058ff08c2 (patch)
treee5ce7b1e0d5df0f3365795d348b938b8b185281b /src
parent7ee737f0d38bd815dc26a81a440148beebb17385 (diff)
downloadJRummikub-63ffedd7b0ecfbf690551b0e2fefac3058ff08c2.tar
JRummikub-63ffedd7b0ecfbf690551b0e2fefac3058ff08c2.zip
Add name to player model
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@145 72836036-5685-4462-b002-a69064685172
Diffstat (limited to 'src')
-rw-r--r--src/jrummikub/model/GameState.java8
-rw-r--r--src/jrummikub/model/IPlayer.java2
-rw-r--r--src/jrummikub/model/Player.java9
3 files changed, 14 insertions, 5 deletions
diff --git a/src/jrummikub/model/GameState.java b/src/jrummikub/model/GameState.java
index 0e43a9c..3bd4d94 100644
--- a/src/jrummikub/model/GameState.java
+++ b/src/jrummikub/model/GameState.java
@@ -14,10 +14,10 @@ public class GameState implements IGameState {
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));
+ players.add(new Player("Player 1", Color.RED));
+ players.add(new Player("Player 2", Color.YELLOW));
+ players.add(new Player("Player 3", Color.GREEN));
+ players.add(new Player("Player 4", Color.BLACK));
activePlayer = 0;
gameHeap = new StoneHeap();
}
diff --git a/src/jrummikub/model/IPlayer.java b/src/jrummikub/model/IPlayer.java
index 1ed0554..17e37e7 100644
--- a/src/jrummikub/model/IPlayer.java
+++ b/src/jrummikub/model/IPlayer.java
@@ -8,4 +8,6 @@ public interface IPlayer {
public Color getColor();
+ public String getName();
+
} \ No newline at end of file
diff --git a/src/jrummikub/model/Player.java b/src/jrummikub/model/Player.java
index d5bda32..623915d 100644
--- a/src/jrummikub/model/Player.java
+++ b/src/jrummikub/model/Player.java
@@ -6,12 +6,14 @@ import java.awt.Color;
public class Player implements IPlayer {
private IHand hand;
+ private String name;
private Color color;
// private String name;
- public Player(Color color) {
+ public Player(String name, Color color) {
hand = new Hand();
+ this.name = name;
this.color = color;
}
@@ -24,4 +26,9 @@ public class Player implements IPlayer {
public Color getColor() {
return color;
}
+
+ @Override
+ public String getName() {
+ return name;
+ }
}