From fc6eed48e8b0f0e0d1165c645b7157e1a48631d1 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Fri, 10 Dec 2021 18:07:59 +0100 Subject: [PATCH] create Method getBoardTextView in SiedlerGame --- src/ch/zhaw/catan/Siedler.java | 6 +++--- src/ch/zhaw/catan/SiedlerGame.java | 9 ++++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java index 5df282c..4e58c64 100644 --- a/src/ch/zhaw/catan/Siedler.java +++ b/src/ch/zhaw/catan/Siedler.java @@ -31,7 +31,7 @@ public class Siedler { boolean diceThrown = false; while (running) { Config.Faction currentPlayerFaction = game.getCurrentPlayerFaction(); - parser.displayGameboard(game.getBoard().getTextView()); + parser.displayGameboard(game.getBoardTextView()); parser.playerTurn(currentPlayerFaction); if (!diceThrown) { throwDice(parser, game); @@ -170,7 +170,7 @@ public class Siedler { * @param payout true (for second Settlement in founding Phase): the Player gets a payout for the settlement. false (for first Settlement in founding Phase): The Player gets no payout. */ private static void buildStructuresInFoundingPhase(Parser parser, SiedlerGame game, Boolean payout) { - parser.displayGameboard(game.getBoard().getTextView()); + parser.displayGameboard(game.getBoardTextView()); parser.playerTurn(game.getCurrentPlayerFaction()); //build Settlement @@ -185,7 +185,7 @@ public class Siedler { } while (!successful); //build Road - parser.displayGameboard(game.getBoard().getTextView()); + parser.displayGameboard(game.getBoardTextView()); parser.giveCoordinatesForStructures(Config.Structure.ROAD); successful = false; do { diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index 2d411ae..fcf3534 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -123,7 +123,7 @@ public class SiedlerGame { } /** - * Returns the game board. + * Returns the game board. Used for test * * @return the game board */ @@ -131,6 +131,13 @@ public class SiedlerGame { return board; } + /** + * Returns the String used to show the Board + * + * @return String of the Board. + */ + public String getBoardTextView(){return board.toString();} + /** * Returns the {@link Config.Faction} of the current player. *