created Class Siedler

This commit is contained in:
schrom01 2021-11-24 17:16:13 +01:00
parent ad1227ac98
commit 8b61927eae
3 changed files with 32 additions and 5 deletions

View File

@ -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());
}
}

View File

@ -40,12 +40,12 @@ public class SiedlerBoard extends HexBoard<Land, String, String, String> {
} }
public SiedlerBoardTextView getTextView () { public String getTextView () {
SiedlerBoardTextView view = new SiedlerBoardTextView(this); SiedlerBoardTextView view = new SiedlerBoardTextView(this);
for (Map.Entry<Point, Label> e : lowerFieldLabel.entrySet()) { for (Map.Entry<Point, Label> e : lowerFieldLabel.entrySet()) {
view.setLowerFieldLabel(e.getKey(), e.getValue()); view.setLowerFieldLabel(e.getKey(), e.getValue());
} }
return view; return view.toString();
} }
private void placeFieldWithoutLabel(Land fieldType, Integer[][] fieldCoordinates) { private void placeFieldWithoutLabel(Land fieldType, Integer[][] fieldCoordinates) {

View File

@ -2,6 +2,10 @@ 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.Point;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -20,6 +24,8 @@ public class SiedlerGame {
static final int FOUR_TO_ONE_TRADE_OFFER = 4; static final int FOUR_TO_ONE_TRADE_OFFER = 4;
static final int FOUR_TO_ONE_TRADE_WANT = 1; static final int FOUR_TO_ONE_TRADE_WANT = 1;
SiedlerBoard board;
/** /**
* Constructs a SiedlerGame game state object. * Constructs a SiedlerGame game state object.
* *
@ -30,7 +36,8 @@ public class SiedlerGame {
* three or players is not between two and four * three or players is not between two and four
*/ */
public SiedlerGame(int winPoints, int numberOfPlayers) { public SiedlerGame(int winPoints, int numberOfPlayers) {
// TODO: Implement board = new SiedlerBoard();
board.createFixGamefield();
} }
/** /**
@ -73,7 +80,7 @@ public class SiedlerGame {
*/ */
public SiedlerBoard getBoard() { public SiedlerBoard getBoard() {
// TODO: Implement // TODO: Implement
return null; return board;
} }
/** /**