From 8b61927eae62f6ba0dc3d087961ad456dd09dc16 Mon Sep 17 00:00:00 2001 From: schrom01 Date: Wed, 24 Nov 2021 17:16:13 +0100 Subject: [PATCH] created Class Siedler --- src/ch/zhaw/catan/Siedler.java | 20 ++++++++++++++++++++ src/ch/zhaw/catan/SiedlerBoard.java | 4 ++-- src/ch/zhaw/catan/SiedlerGame.java | 13 ++++++++++--- 3 files changed, 32 insertions(+), 5 deletions(-) create mode 100644 src/ch/zhaw/catan/Siedler.java diff --git a/src/ch/zhaw/catan/Siedler.java b/src/ch/zhaw/catan/Siedler.java new file mode 100644 index 0000000..9c3ea12 --- /dev/null +++ b/src/ch/zhaw/catan/Siedler.java @@ -0,0 +1,20 @@ +package ch.zhaw.catan; + +import org.beryx.textio.TextIO; +import org.beryx.textio.TextIoFactory; +import org.beryx.textio.TextTerminal; + +public class Siedler { + + public static void main(String[] args) { + + //Spiel erstellen + SiedlerGame game = new SiedlerGame(0, 0); + + //Spielfeld ausgeben + TextIO textIO = TextIoFactory.getTextIO(); + TextTerminal textTerminal = textIO.getTextTerminal(); + textTerminal.println(game.getBoard().getTextView()); + + } +} diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java index 06119e9..b073e13 100644 --- a/src/ch/zhaw/catan/SiedlerBoard.java +++ b/src/ch/zhaw/catan/SiedlerBoard.java @@ -40,12 +40,12 @@ public class SiedlerBoard extends HexBoard { } - public SiedlerBoardTextView getTextView () { + public String getTextView () { SiedlerBoardTextView view = new SiedlerBoardTextView(this); for (Map.Entry e : lowerFieldLabel.entrySet()) { view.setLowerFieldLabel(e.getKey(), e.getValue()); } - return view; + return view.toString(); } private void placeFieldWithoutLabel(Land fieldType, Integer[][] fieldCoordinates) { diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index a482921..48405eb 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -2,6 +2,10 @@ 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.Collections; import java.util.List; @@ -19,7 +23,9 @@ import java.util.Map; public class SiedlerGame { static final int FOUR_TO_ONE_TRADE_OFFER = 4; static final int FOUR_TO_ONE_TRADE_WANT = 1; - + + SiedlerBoard board; + /** * Constructs a SiedlerGame game state object. * @@ -30,7 +36,8 @@ public class SiedlerGame { * three or players is not between two and four */ public SiedlerGame(int winPoints, int numberOfPlayers) { - // TODO: Implement + board = new SiedlerBoard(); + board.createFixGamefield(); } /** @@ -73,7 +80,7 @@ public class SiedlerGame { */ public SiedlerBoard getBoard() { // TODO: Implement - return null; + return board; } /**