From 792944a7ceaaa522360e0c8a4af6d99952914dc1 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 10 Dec 2021 10:46:48 +0100 Subject: [PATCH 1/5] Finished Class Field (Cleanup and Javadoc) --- src/ch/zhaw/catan/Field.java | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/ch/zhaw/catan/Field.java b/src/ch/zhaw/catan/Field.java index 9d43114..24735e3 100644 --- a/src/ch/zhaw/catan/Field.java +++ b/src/ch/zhaw/catan/Field.java @@ -2,24 +2,50 @@ package ch.zhaw.catan; import ch.zhaw.hexboard.Label; +/** + * Field Class stores Land and Label in Corresponding Field. + * + * @author Roman Schenk + */ public class Field { private final Config.Land land; private final Label label; + /** + * Constructs field object that stores land and label object in Field. + * + * @param land that will be stored in Field + * @param label that will be stored in Field + */ public Field(Config.Land land, Label label) { this.land = land; this.label = label; } + /** + * Returns the Resource type of the field. + * + * @return Config.Resource of the field + */ public Config.Resource getResource() { return land.getResource(); } + /** + * Return the Land type of the field. + * + * @return Config.Land of the field + */ public Config.Land getLand() { return land; } + /** + * Return the label of the field. + * + * @return Label of the field + */ public Label getLabel() { return label; } From f30c145dcf9d1fc70543458cf4be4d3a17eca6a0 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 10 Dec 2021 10:52:58 +0100 Subject: [PATCH 2/5] Finished Class Parser just one open question remaining winpoints (Cleanup and Javadoc) --- src/ch/zhaw/catan/Parser.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index a43352a..4a79ac5 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -77,6 +77,7 @@ public class Parser { gameStartValues.put("NumberOfPlayers", textIO.newIntInputReader().withMinVal(Config.MIN_NUMBER_OF_PLAYERS).withMaxVal(4).read("Number of players:")); gameStartValues.put("NumberOfWinPoints", textIO.newIntInputReader().withMinVal(5).withMaxVal(15).read("Winpoints needed for Victory:")); return gameStartValues; + //Todo find out how many max and min Win Points } /** @@ -102,7 +103,7 @@ public class Parser { } /** - * Outputs which player currently is at turn + * Outputs which player currently is at turn. * * @param faction the faction which turn it is */ From 828218023fa64ee3370bc064f01fc542ca59c96a Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 10 Dec 2021 10:57:28 +0100 Subject: [PATCH 3/5] Javadoc Player --- .idea/codeStyles/Project.xml | 11 +++++++++++ src/ch/zhaw/catan/Command.java | 3 ++- src/ch/zhaw/catan/Player.java | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 .idea/codeStyles/Project.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..fb9db83 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,11 @@ + + + + + + + \ No newline at end of file diff --git a/src/ch/zhaw/catan/Command.java b/src/ch/zhaw/catan/Command.java index 8b5b103..3c0d40f 100644 --- a/src/ch/zhaw/catan/Command.java +++ b/src/ch/zhaw/catan/Command.java @@ -1,8 +1,9 @@ package ch.zhaw.catan; - /** + * This enum is used to define the Commandwords. * + * @author Leonardo Brandenberger */ public enum Command { NEXT_PLAYER("next player"), BUILD_SETTLEMENT("build settlement"), BUILD_CITY("build city"), diff --git a/src/ch/zhaw/catan/Player.java b/src/ch/zhaw/catan/Player.java index fb74e2f..dc1f8a8 100644 --- a/src/ch/zhaw/catan/Player.java +++ b/src/ch/zhaw/catan/Player.java @@ -2,11 +2,12 @@ package ch.zhaw.catan; import java.util.HashMap; import java.util.List; -//TODO Java Doc /** * This class is here in order to maintain the resources of the players, the amount of structures that they can build, * control to see if a player has enough to build a new structure and to add them into a faction. + * + * @author Leonardo Brandenberger, Roman Schrom, Andrin Fassbind, Stefan Amador */ public class Player { @@ -112,7 +113,6 @@ public class Player { * @param list the list that shows how many resources are required. * @return true if the player has enough resources to build and return false if he doesn't. */ - //returns true if player has enough resources else false private boolean checkResourceToBuild(List list) { HashMap costs = new HashMap<>(); for (Config.Resource resource : list) { From 3192039ca444f0d285c244638bbfab8ffa972ff0 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 10 Dec 2021 11:00:15 +0100 Subject: [PATCH 4/5] Finished Parser winpoints min 3 set. --- src/ch/zhaw/catan/Parser.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index 4a79ac5..ca19245 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -75,9 +75,8 @@ public class Parser { public HashMap gameStart() { HashMap gameStartValues = new HashMap<>(); gameStartValues.put("NumberOfPlayers", textIO.newIntInputReader().withMinVal(Config.MIN_NUMBER_OF_PLAYERS).withMaxVal(4).read("Number of players:")); - gameStartValues.put("NumberOfWinPoints", textIO.newIntInputReader().withMinVal(5).withMaxVal(15).read("Winpoints needed for Victory:")); + gameStartValues.put("NumberOfWinPoints", textIO.newIntInputReader().withMinVal(3).read("Winpoints needed for Victory:")); return gameStartValues; - //Todo find out how many max and min Win Points } /** From 36614982163f6ec754f6a36a16d36597ef386c65 Mon Sep 17 00:00:00 2001 From: Leonardo Brandenberger Date: Fri, 10 Dec 2021 11:02:15 +0100 Subject: [PATCH 5/5] Finished Parser winpoints min 3 set. --- src/ch/zhaw/catan/Parser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ch/zhaw/catan/Parser.java b/src/ch/zhaw/catan/Parser.java index ca19245..8103cdf 100644 --- a/src/ch/zhaw/catan/Parser.java +++ b/src/ch/zhaw/catan/Parser.java @@ -134,6 +134,7 @@ public class Parser { * @param give if true ask for resource to give if false for resource to receive * @return Config.Resource the resource the player would like to give or receive */ + public Config.Resource trade(boolean give) { String output = "give"; if (!give) {