diff --git a/.idea/misc.xml b/.idea/misc.xml index b573818..6bc01a8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ch/zhaw/catan/Settlement.java b/src/ch/zhaw/catan/Settlement.java index d926308..4fc1da4 100644 --- a/src/ch/zhaw/catan/Settlement.java +++ b/src/ch/zhaw/catan/Settlement.java @@ -5,6 +5,8 @@ import java.awt.Point; /** * Sub Class of Structure and Super Class of City * Can be saved in Siedler Board on a corner + * + * @author Andrin Fassbind, Roman Schenk */ public class Settlement extends Structure { @@ -17,6 +19,8 @@ public class Settlement extends Structure { } /** + * This Methode Returns the Position of the Settlement + * * @return the datafield position */ public Point getPosition() { diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 7211246..5df282c 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -5,6 +5,8 @@ import java.util.Random; /** * This Class manages the game process and contains the Main Method which creates and starts a new Parser and a new Game. + * + * @author Leonardo Brandeberger, Roman Schenk */ public class Siedler { /** @@ -29,7 +31,7 @@ public class Siedler { boolean diceThrown = false; while (running) { Config.Faction currentPlayerFaction = game.getCurrentPlayerFaction(); - parser.displayGameboard(game.getBoard().getTextView()); //TODO Every turn or separate command? + parser.displayGameboard(game.getBoard().getTextView()); parser.playerTurn(currentPlayerFaction); if (!diceThrown) { throwDice(parser, game); diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index cd7ceb0..adf84fb 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -11,7 +11,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -//TODO Enhance JavaDoc /** * Subclass of HexBoard @@ -22,12 +21,11 @@ public class SiedlerBoard extends HexBoard fields = new HashMap<>(); private Config.Faction longestRoadFaction = null; - private int longestRoadLenth = 0; + private int longestRoadLength = 0; /** * Method to create the predefined game field from Config. @@ -49,6 +47,15 @@ public class SiedlerBoard extends HexBoard longestRoadLenth && players.get(factionA) > 4) { + if (players.get(factionA) > longestRoadLength && players.get(factionA) > 4) { longestRoadFaction = factionA; - longestRoadLenth = players.get(factionA); + longestRoadLength = players.get(factionA); } } return longestRoadFaction; } - //todo javadoc - public int getLongestRoadLenth() { - return longestRoadLenth; - } - /** * This method is recursive and adds all roads which belongs to a specific players and stringing together to a HashSet. * The length of the HashSet represents the length of the longest Road the player has. diff --git a/test/ch/zhaw/catan/SiedlerBoardTest.java b/test/ch/zhaw/catan/SiedlerBoardTest.java index f083917..8452824 100644 --- a/test/ch/zhaw/catan/SiedlerBoardTest.java +++ b/test/ch/zhaw/catan/SiedlerBoardTest.java @@ -41,7 +41,7 @@ public class SiedlerBoardTest { System.out.println(board.getTextView()); assertEquals(Config.Faction.BLUE, board.getLongestRoadFaction(factionList)); - assertEquals(6, board.getLongestRoadLenth()); + assertEquals(6, board.getLongestRoadLength()); } @Test @@ -50,7 +50,7 @@ public class SiedlerBoardTest { System.out.println(board.getTextView()); assertEquals(Config.Faction.BLUE, board.getLongestRoadFaction(factionList)); - assertEquals(5, board.getLongestRoadLenth()); + assertEquals(5, board.getLongestRoadLength()); } }