Removed TODO comments of finished methods and removed unnecessary variable

This commit is contained in:
MikeZyeman 2021-12-02 16:25:38 +01:00
parent 60d1c9a90b
commit b1ba5636ce
3 changed files with 8 additions and 19 deletions

View File

@ -21,7 +21,5 @@ public class Siedler {
} }
} }

View File

@ -5,8 +5,8 @@ import ch.zhaw.hexboard.HexBoard;
import ch.zhaw.hexboard.Label; import ch.zhaw.hexboard.Label;
import java.awt.*; import java.awt.*;
import java.util.*;
import java.util.List; import java.util.List;
import java.util.*;
public class SiedlerBoard extends HexBoard<Land, Structure, Road, String> { public class SiedlerBoard extends HexBoard<Land, Structure, Road, String> {
@ -58,7 +58,6 @@ public class SiedlerBoard extends HexBoard<Land, Structure, Road, String> {
* @return the fields associated with the dice value * @return the fields associated with the dice value
*/ */
public List<Point> getFieldsForDiceValue(int dice) { public List<Point> getFieldsForDiceValue(int dice) {
//TODO: Implement.
ArrayList<Point> fields = new ArrayList<>(); ArrayList<Point> fields = new ArrayList<>();
for(Point field : lowerFieldLabel.keySet()){ for(Point field : lowerFieldLabel.keySet()){
if(getDiceNumber(field) == dice){ if(getDiceNumber(field) == dice){

View File

@ -2,12 +2,12 @@ package ch.zhaw.catan;
import ch.zhaw.catan.Config.Faction; import ch.zhaw.catan.Config.Faction;
import ch.zhaw.catan.Config.Resource; 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.awt.*;
import java.util.*; 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. * Switches to the next player in the defined sequence of players.
*/ */
public void switchToNextPlayer() { public void switchToNextPlayer() {
// TODO: Implement
if (activePlayer < allPlayers.size()){ if (activePlayer < allPlayers.size()){
activePlayer++; activePlayer++;
} }
@ -71,7 +70,6 @@ public class SiedlerGame {
* Switches to the previous player in the defined sequence of players. * Switches to the previous player in the defined sequence of players.
*/ */
public void switchToPreviousPlayer() { public void switchToPreviousPlayer() {
// TODO: Implement
if (activePlayer > 0){ if (activePlayer > 0){
activePlayer--; activePlayer--;
} }
@ -94,7 +92,6 @@ public class SiedlerGame {
* @return the list with player's factions * @return the list with player's factions
*/ */
public List<Faction> getPlayerFactions() { public List<Faction> getPlayerFactions() {
// TODO: Implement
List<Faction> factions = new ArrayList<>(); List<Faction> factions = new ArrayList<>();
for (Player player: allPlayers ) { for (Player player: allPlayers ) {
factions.add(player.getFaction()); factions.add(player.getFaction());
@ -130,8 +127,7 @@ public class SiedlerGame {
* @return the number of resource cards of this type * @return the number of resource cards of this type
*/ */
public int getCurrentPlayerResourceStock(Resource resource) { public int getCurrentPlayerResourceStock(Resource resource) {
int ressourceInStock = allPlayers.get(activePlayer).getSpecificResource(resource); return allPlayers.get(activePlayer).getSpecificResource(resource);
return ressourceInStock;
} }
/** /**
@ -204,19 +200,17 @@ public class SiedlerGame {
* @return true, if the placement was successful * @return true, if the placement was successful
*/ */
public boolean buildSettlement(Point position) { public boolean buildSettlement(Point position) {
//TODO Errors should be caught after this method is executed and returns false
//1. Check if Corner //1. Check if Corner
if (!board.hasCorner(position)) { if (!board.hasCorner(position)) {
// TODO: Error message
return false; return false;
} }
//2. Check if Corner is empty //2. Check if Corner is empty
if (board.getCorner(position) != null) { if (board.getCorner(position) != null) {
// TODO: Error message
return false; return false;
} }
//3. Can Player build Settlement //3. Can Player build Settlement
if (!allPlayers.get(activePlayer).buildSettlement()) { if (!allPlayers.get(activePlayer).buildSettlement()) {
// TODO: Error message
return false; return false;
} }
//4. Insert Road to map //4. Insert Road to map
@ -294,7 +288,6 @@ public class SiedlerGame {
* @return true, if the trade was successful * @return true, if the trade was successful
*/ */
public boolean tradeWithBankFourToOne(Resource offer, Resource want) { public boolean tradeWithBankFourToOne(Resource offer, Resource want) {
// TODO: Implement
return bank.tradeWithBank(want, offer, FOUR_TO_ONE_TRADE_WANT, FOUR_TO_ONE_TRADE_OFFER); 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) * @return the winner of the game or null, if there is no winner (yet)
*/ */
public Faction getWinner() { public Faction getWinner() {
// TODO: Implement
HashMap<Faction, Integer> winPoints = getWinPoints(); HashMap<Faction, Integer> winPoints = getWinPoints();
for(Faction faction : winPoints.keySet()){ for(Faction faction : winPoints.keySet()){
if(winPoints.get(faction) >= winPointsForWin){ if(winPoints.get(faction) >= winPointsForWin){