From b1ba5636ceac0ceb431869c8a27798f5b289b718 Mon Sep 17 00:00:00 2001 From: MikeZyeman Date: Thu, 2 Dec 2021 16:25:38 +0100 Subject: [PATCH] Removed TODO comments of finished methods and removed unnecessary variable --- src/ch/zhaw/catan/Siedler.java | 2 -- src/ch/zhaw/catan/SiedlerBoard.java | 3 +-- src/ch/zhaw/catan/SiedlerGame.java | 22 +++++++--------------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index d3bd7d9..53a0f3c 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -21,7 +21,5 @@ public class Siedler { - - } } diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index 30910f7..e27f855 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -5,8 +5,8 @@ import ch.zhaw.hexboard.HexBoard; import ch.zhaw.hexboard.Label; import java.awt.*; -import java.util.*; import java.util.List; +import java.util.*; public class SiedlerBoard extends HexBoard { @@ -58,7 +58,6 @@ public class SiedlerBoard extends HexBoard { * @return the fields associated with the dice value */ public List getFieldsForDiceValue(int dice) { - //TODO: Implement. ArrayList fields = new ArrayList<>(); for(Point field : lowerFieldLabel.keySet()){ if(getDiceNumber(field) == dice){ diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 4ab205d..9245724 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -2,12 +2,12 @@ package ch.zhaw.catan; import ch.zhaw.catan.Config.Faction; import ch.zhaw.catan.Config.Resource; -import org.beryx.textio.TextIO; -import org.beryx.textio.TextIoFactory; -import org.beryx.textio.TextTerminal; -import java.awt.Point; -import java.util.*; +import java.awt.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** @@ -58,7 +58,6 @@ public class SiedlerGame { * Switches to the next player in the defined sequence of players. */ public void switchToNextPlayer() { - // TODO: Implement if (activePlayer < allPlayers.size()){ activePlayer++; } @@ -71,7 +70,6 @@ public class SiedlerGame { * Switches to the previous player in the defined sequence of players. */ public void switchToPreviousPlayer() { - // TODO: Implement if (activePlayer > 0){ activePlayer--; } @@ -94,7 +92,6 @@ public class SiedlerGame { * @return the list with player's factions */ public List getPlayerFactions() { - // TODO: Implement List factions = new ArrayList<>(); for (Player player: allPlayers ) { factions.add(player.getFaction()); @@ -130,8 +127,7 @@ public class SiedlerGame { * @return the number of resource cards of this type */ public int getCurrentPlayerResourceStock(Resource resource) { - int ressourceInStock = allPlayers.get(activePlayer).getSpecificResource(resource); - return ressourceInStock; + return allPlayers.get(activePlayer).getSpecificResource(resource); } /** @@ -204,19 +200,17 @@ public class SiedlerGame { * @return true, if the placement was successful */ public boolean buildSettlement(Point position) { + //TODO Errors should be caught after this method is executed and returns false //1. Check if Corner if (!board.hasCorner(position)) { - // TODO: Error message return false; } //2. Check if Corner is empty if (board.getCorner(position) != null) { - // TODO: Error message return false; } //3. Can Player build Settlement if (!allPlayers.get(activePlayer).buildSettlement()) { - // TODO: Error message return false; } //4. Insert Road to map @@ -294,7 +288,6 @@ public class SiedlerGame { * @return true, if the trade was successful */ public boolean tradeWithBankFourToOne(Resource offer, Resource want) { - // TODO: Implement return bank.tradeWithBank(want, offer, FOUR_TO_ONE_TRADE_WANT, FOUR_TO_ONE_TRADE_OFFER); } @@ -304,7 +297,6 @@ public class SiedlerGame { * @return the winner of the game or null, if there is no winner (yet) */ public Faction getWinner() { - // TODO: Implement HashMap winPoints = getWinPoints(); for(Faction faction : winPoints.keySet()){ if(winPoints.get(faction) >= winPointsForWin){