create Method getBoardTextView in SiedlerGame

This commit is contained in:
Andrin Fassbind 2021-12-10 18:07:59 +01:00
parent 0ea44905e2
commit fc6eed48e8
2 changed files with 11 additions and 4 deletions

View File

@ -31,7 +31,7 @@ public class Siedler {
boolean diceThrown = false; boolean diceThrown = false;
while (running) { while (running) {
Config.Faction currentPlayerFaction = game.getCurrentPlayerFaction(); Config.Faction currentPlayerFaction = game.getCurrentPlayerFaction();
parser.displayGameboard(game.getBoard().getTextView()); parser.displayGameboard(game.getBoardTextView());
parser.playerTurn(currentPlayerFaction); parser.playerTurn(currentPlayerFaction);
if (!diceThrown) { if (!diceThrown) {
throwDice(parser, game); 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. * @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) { private static void buildStructuresInFoundingPhase(Parser parser, SiedlerGame game, Boolean payout) {
parser.displayGameboard(game.getBoard().getTextView()); parser.displayGameboard(game.getBoardTextView());
parser.playerTurn(game.getCurrentPlayerFaction()); parser.playerTurn(game.getCurrentPlayerFaction());
//build Settlement //build Settlement
@ -185,7 +185,7 @@ public class Siedler {
} while (!successful); } while (!successful);
//build Road //build Road
parser.displayGameboard(game.getBoard().getTextView()); parser.displayGameboard(game.getBoardTextView());
parser.giveCoordinatesForStructures(Config.Structure.ROAD); parser.giveCoordinatesForStructures(Config.Structure.ROAD);
successful = false; successful = false;
do { do {

View File

@ -123,7 +123,7 @@ public class SiedlerGame {
} }
/** /**
* Returns the game board. * Returns the game board. Used for test
* *
* @return the game board * @return the game board
*/ */
@ -131,6 +131,13 @@ public class SiedlerGame {
return board; 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. * Returns the {@link Config.Faction} of the current player.
* *