diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..6a3417b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/out/
diff --git a/.idea/misc.xml b/.idea/misc.xml
index c3dfb30..b573818 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Faction.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Faction.class
index d312fff..a9c9a44 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Faction.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Faction.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Land.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Land.class
index 2a20065..a0e3700 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Land.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Land.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Resource.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Resource.class
index 58f80c1..82c496d 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Resource.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Resource.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Structure.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Structure.class
index 169ab41..cfb9237 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Structure.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config$Structure.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config.class
index 922ab81..598fcb0 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Config.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy.class
deleted file mode 100644
index d1759cf..0000000
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/Dummy.class and /dev/null differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class
index ae45f03..f7ba452 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoard.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoardTextView.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoardTextView.class
index fd38f02..26d90d1 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoardTextView.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerBoardTextView.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerGame.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerGame.class
index 1abbc24..ff2127d 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerGame.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/catan/SiedlerGame.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Edge.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Edge.class
index a034cf4..3a582a1 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Edge.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Edge.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/FieldAnnotationPosition.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/FieldAnnotationPosition.class
index 50b3008..064c70d 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/FieldAnnotationPosition.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/FieldAnnotationPosition.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoard.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoard.class
index 54b55a6..c212f56 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoard.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoard.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoardTextView.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoardTextView.class
index d987cad..9904f75 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoardTextView.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/HexBoardTextView.class differ
diff --git a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Label.class b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Label.class
index 3dd5342..85f9148 100644
Binary files a/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Label.class and b/out/production/gruppe06-hufflepuff-projekt3-catan/ch/zhaw/hexboard/Label.class differ
diff --git a/src/ch/zhaw/catan/Dummy.java b/src/ch/zhaw/catan/Dummy.java
index fdcab53..e9eb5db 100644
--- a/src/ch/zhaw/catan/Dummy.java
+++ b/src/ch/zhaw/catan/Dummy.java
@@ -15,15 +15,14 @@ public class Dummy {
SHOW, QUIT
}
-
private void run() {
TextIO textIO = TextIoFactory.getTextIO();
TextTerminal> textTerminal = textIO.getTextTerminal();
SiedlerBoard board = new SiedlerBoard();
board.addField(new Point(2, 2), Land.FOREST);
- board.setCorner(new Point(3, 3), "RR");
- board.setEdge(new Point(2, 0), new Point(3, 1), "r");
+ board.setCorner(new Point(3, 3), new Settlement(Config.Faction.RED));
+ board.setEdge(new Point(2, 0), new Point(3, 1), new Road(Config.Faction.BLUE));
board.addFieldAnnotation(new Point(2, 2), new Point(3, 1), "AA");
Map lowerFieldLabel = new HashMap<>();
diff --git a/src/ch/zhaw/catan/Player.java b/src/ch/zhaw/catan/Player.java
new file mode 100644
index 0000000..965f7fd
--- /dev/null
+++ b/src/ch/zhaw/catan/Player.java
@@ -0,0 +1,61 @@
+package ch.zhaw.catan;
+
+import java.util.HashMap;
+
+/**
+ * New Class PLayer
+ * This class is here to add players to the game.
+ * @author: Stefan Amador
+ */
+public class Player {
+
+ private String name;
+ private Config.Faction faction;
+ private HashMap resources;
+ private int roadsToUse;
+ private int settlementsToUse;
+
+ public Player (String name, Config.Faction faction){
+ //Datenfelder
+ this.name = name;
+ this.faction = faction;
+ roadsToUse = Config.Structure.ROAD.getStockPerPlayer();
+ settlementsToUse = Config.Structure.SETTLEMENT.getStockPerPlayer();
+ //Ressourcen initialisiern
+ resources = new HashMap<>();
+ for(Config.Resource resource : Config.Resource.values()) {
+ resources.put(resource,0);
+ }
+
+ }
+
+ /**
+ * This method returns all the resources the player has at the moment
+ * @return HashMap
+ */
+ public HashMap getResources() {
+ return resources;
+ }
+
+
+ public boolean buildRoad() {
+ if (roadsToUse > 0) {
+ roadsToUse--;
+ return true;
+ }
+ return false;
+
+ }
+
+
+ public boolean buildSettlement() {
+ if (settlementsToUse > 0) {
+ settlementsToUse--;
+ return true;
+ }
+ return false;
+ }
+
+
+
+}
diff --git a/src/ch/zhaw/catan/Road.java b/src/ch/zhaw/catan/Road.java
new file mode 100644
index 0000000..360e794
--- /dev/null
+++ b/src/ch/zhaw/catan/Road.java
@@ -0,0 +1,19 @@
+package ch.zhaw.catan;
+
+import java.util.HashMap;
+
+public class Road {
+ private HashMap buildCost;
+ private Config.Faction faction;
+
+ public Road(Config.Faction faction) {
+ this.faction = faction;
+ buildCost = new HashMap<>();
+ buildCost.put(Config.Resource.BRICK,1);
+ buildCost.put(Config.Resource.LUMBER,1);
+ }
+
+ public HashMap getBuildCost() {
+ return buildCost;
+ }
+}
diff --git a/src/ch/zhaw/catan/Settlement.java b/src/ch/zhaw/catan/Settlement.java
new file mode 100644
index 0000000..6e11e5d
--- /dev/null
+++ b/src/ch/zhaw/catan/Settlement.java
@@ -0,0 +1,22 @@
+package ch.zhaw.catan;
+
+import java.util.HashMap;
+
+public class Settlement {
+ private HashMap buildCost;
+ private Config.Faction faction;
+
+ public Settlement(Config.Faction faction) {
+ this.faction = faction;
+ buildCost = new HashMap<>();
+ buildCost.put(Config.Resource.LUMBER,1);
+ buildCost.put(Config.Resource.BRICK,1);
+ buildCost.put(Config.Resource.GRAIN,1);
+ buildCost.put(Config.Resource.WOOL,1);
+ }
+
+ public HashMap getBuildCost() {
+ return buildCost;
+ }
+
+}
diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java
index 9c3ea12..7610db4 100644
--- a/src/ch/zhaw/catan/Siedler.java
+++ b/src/ch/zhaw/catan/Siedler.java
@@ -16,5 +16,7 @@ public class Siedler {
TextTerminal> textTerminal = textIO.getTextTerminal();
textTerminal.println(game.getBoard().getTextView());
+
+
}
}
diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java
index cb52d1e..1466d52 100644
--- a/src/ch/zhaw/catan/SiedlerBoard.java
+++ b/src/ch/zhaw/catan/SiedlerBoard.java
@@ -8,7 +8,7 @@ import java.awt.*;
import java.util.*;
import java.util.List;
-public class SiedlerBoard extends HexBoard {
+public class SiedlerBoard extends HexBoard {
Map lowerFieldLabel = new HashMap<>();
diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java
index 48405eb..b76c075 100644
--- a/src/ch/zhaw/catan/SiedlerGame.java
+++ b/src/ch/zhaw/catan/SiedlerGame.java
@@ -24,7 +24,9 @@ public class SiedlerGame {
static final int FOUR_TO_ONE_TRADE_OFFER = 4;
static final int FOUR_TO_ONE_TRADE_WANT = 1;
- SiedlerBoard board;
+ private SiedlerBoard board;
+ private Player[] allPlayers;
+ private int winPoints;
/**
* Constructs a SiedlerGame game state object.
@@ -38,6 +40,8 @@ public class SiedlerGame {
public SiedlerGame(int winPoints, int numberOfPlayers) {
board = new SiedlerBoard();
board.createFixGamefield();
+ allPlayers = new Player[numberOfPlayers];
+ this.winPoints = winPoints;
}
/**
@@ -69,6 +73,9 @@ public class SiedlerGame {
*/
public List getPlayerFactions() {
// TODO: Implement
+ Faction[] factions = new Faction[allPlayers.length];
+
+
return Collections.emptyList();
}
@@ -212,7 +219,18 @@ public class SiedlerGame {
* @return true, if the placement was successful
*/
public boolean buildRoad(Point roadStart, Point roadEnd) {
- // TODO: Implement
+ //1. Check if Edge
+ if(!board.hasEdge(roadStart,roadEnd)){
+ // TODO: Error message
+ }
+ //2. Check if Edge is empty
+ if(board.getEdge(roadStart,roadEnd) != null) {
+ // TODO: Error message
+ }
+ //3. Can Player build road
+ // TODO
+
+
return false;
}
diff --git a/src/ch/zhaw/hexboard/HexBoardTextView.java b/src/ch/zhaw/hexboard/HexBoardTextView.java
index 97c51af..b3eeb98 100644
--- a/src/ch/zhaw/hexboard/HexBoardTextView.java
+++ b/src/ch/zhaw/hexboard/HexBoardTextView.java
@@ -98,7 +98,7 @@ import java.util.Map;
public class HexBoardTextView {
private static final String ONE_SPACE = " ";
- private static final String TWO_SPACES = " ";
+ private static final String TWO_SPACES = " ";
private static final String FOUR_SPACES = " ";
private static final String FIVE_SPACES = " ";
private static final String SIX_SPACES = " ";