diff options
Diffstat (limited to 'src/jrummikub')
-rw-r--r-- | src/jrummikub/model/GameState.java | 17 | ||||
-rw-r--r-- | src/jrummikub/model/Hand.java | 15 | ||||
-rw-r--r-- | src/jrummikub/model/Player.java | 12 | ||||
-rw-r--r-- | src/jrummikub/model/Stone.java | 2 | ||||
-rw-r--r-- | src/jrummikub/model/StoneHeap.java | 17 | ||||
-rw-r--r-- | src/jrummikub/model/StoneSet.java | 18 | ||||
-rw-r--r-- | src/jrummikub/model/Table.java | 29 |
7 files changed, 108 insertions, 2 deletions
diff --git a/src/jrummikub/model/GameState.java b/src/jrummikub/model/GameState.java new file mode 100644 index 0000000..2e5f17b --- /dev/null +++ b/src/jrummikub/model/GameState.java @@ -0,0 +1,17 @@ +package jrummikub.model; + +public class GameState { + private Table table; + private Player[] players; + private int activePlayer; + private StoneHeap gameHeap; + + public void nextPlayer() { + + } + + public Player activePlayer() { + + } + +} diff --git a/src/jrummikub/model/Hand.java b/src/jrummikub/model/Hand.java new file mode 100644 index 0000000..91696ab --- /dev/null +++ b/src/jrummikub/model/Hand.java @@ -0,0 +1,15 @@ +package jrummikub.model; + +public class Hand { + private Stone[] stones; + private Position[] position; + + public Stone pickUp(Position position) { + + } + + public void drop(Stone stone, Position position) { + + } + +} diff --git a/src/jrummikub/model/Player.java b/src/jrummikub/model/Player.java new file mode 100644 index 0000000..7cc55be --- /dev/null +++ b/src/jrummikub/model/Player.java @@ -0,0 +1,12 @@ +package jrummikub.model; + +import java.awt.Color; + +public class Player { + private Hand hand; + // Könnten wir einfach die Steinfarben vergeben? + private Color color; + + // private String name; + +} diff --git a/src/jrummikub/model/Stone.java b/src/jrummikub/model/Stone.java index ee18a67..47354e5 100644 --- a/src/jrummikub/model/Stone.java +++ b/src/jrummikub/model/Stone.java @@ -1,9 +1,11 @@ package jrummikub.model; +/** */ public class Stone { private int value; private StoneColor color; private final boolean joker; + public Stone(int value, StoneColor color, boolean joker) { this.value = value; diff --git a/src/jrummikub/model/StoneHeap.java b/src/jrummikub/model/StoneHeap.java index bb6470e..f1f833d 100644 --- a/src/jrummikub/model/StoneHeap.java +++ b/src/jrummikub/model/StoneHeap.java @@ -5,10 +5,16 @@ import java.util.EnumSet; import java.util.List; import java.util.Random; +/** + * StoneHeap creates all {@link Stone}s for a game, manages them and allows + * players to draw one or more random Stones. + */ + public class StoneHeap { List<Stone> heap; Random generator = new Random(); + /** Creates 106 Stones according to standard rules */ public StoneHeap() { heap = new ArrayList<Stone>(); for (int i = 1; i <= 13; i++) { @@ -23,13 +29,20 @@ public class StoneHeap { heap.add(new Stone(0, StoneColor.ORANGE, true)); } + /** Removes random {@link Stone} from the heap and returns it */ public Stone drawStone() { return heap.remove(generator.nextInt(heap.size())); } - + + /** + * Removes several {@link Stone}s from the heap and returns them + * + * @param number + * number of requested Stones + */ public List<Stone> drawStones(int number) { List<Stone> drawnStones = new ArrayList<Stone>(); - for (int i=0; i<number; i++){ + for (int i = 0; i < number; i++) { drawnStones.add(drawStone()); } return drawnStones; diff --git a/src/jrummikub/model/StoneSet.java b/src/jrummikub/model/StoneSet.java new file mode 100644 index 0000000..4dd5971 --- /dev/null +++ b/src/jrummikub/model/StoneSet.java @@ -0,0 +1,18 @@ +package jrummikub.model; + +public class StoneSet { + private Stone[] stones; + + public boolean isValid() { + + } + + public StoneSet[] splitAt(int position) { + + } + + public StoneSet join(StoneSet other) { + + } + +} diff --git a/src/jrummikub/model/Table.java b/src/jrummikub/model/Table.java new file mode 100644 index 0000000..6a0a826 --- /dev/null +++ b/src/jrummikub/model/Table.java @@ -0,0 +1,29 @@ +package jrummikub.model; + +public class Table { + private StoneSet[] sets; + private Position[] positions; + + // Constructor + public Table gameTable = new Table(); + + public Stone pickUp(Position position) { + + } + + public StoneSet pickUpSet(Position position) { + + } + + public StoneSet pickUpRange(Position from, Position to) { + + } + + public void drop(Position position, StoneSet stones) { + + } + + public boolean isValid() { + + } +} |