Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
be26fc77cd
|
@ -6,6 +6,9 @@ import org.beryx.textio.TextTerminal;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import static ch.zhaw.catan.Command.*;
|
||||||
|
import static ch.zhaw.catan.Command.QUIT;
|
||||||
|
|
||||||
public class Siedler {
|
public class Siedler {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -14,11 +17,29 @@ public class Siedler {
|
||||||
Parser parser = new Parser();
|
Parser parser = new Parser();
|
||||||
SiedlerGame game = foundingPhase(parser);
|
SiedlerGame game = foundingPhase(parser);
|
||||||
|
|
||||||
parser.getAction();
|
boolean running = true;
|
||||||
|
while (running){
|
||||||
|
parser.playerTurn(game.getCurrentPlayerFaction());
|
||||||
//Spielfeld ausgeben
|
switch (parser.getAction()) {
|
||||||
|
case NEXTPLAYER:
|
||||||
|
game.switchToNextPlayer();
|
||||||
|
break;
|
||||||
|
case BUILDSETTLEMENT:
|
||||||
|
game.
|
||||||
|
break;
|
||||||
|
case BUILDCITY:
|
||||||
|
break;
|
||||||
|
case BUILDROAD:
|
||||||
|
break;
|
||||||
|
case TRADEWITHBANK:
|
||||||
|
break;
|
||||||
|
case QUIT:
|
||||||
|
running = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
parser.errorMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,12 +53,14 @@ public class Siedler {
|
||||||
private static SiedlerGame foundingPhase(Parser parser) {
|
private static SiedlerGame foundingPhase(Parser parser) {
|
||||||
HashMap<String, Integer> gameInfo = parser.gameStart();
|
HashMap<String, Integer> gameInfo = parser.gameStart();
|
||||||
SiedlerGame game = new SiedlerGame(gameInfo.get("NumberOfWinPoints"), gameInfo.get("NumberOfPlayers"));
|
SiedlerGame game = new SiedlerGame(gameInfo.get("NumberOfWinPoints"), gameInfo.get("NumberOfPlayers"));
|
||||||
|
|
||||||
for(int player = 1; player <= gameInfo.get("NumberOfPlayers"); player++){
|
for(int player = 1; player <= gameInfo.get("NumberOfPlayers"); player++){
|
||||||
buildStructuresInFoundingPhase(game, parser, false);
|
buildStructuresInFoundingPhase(game, parser, false);
|
||||||
if(player < gameInfo.get("NumberOfPlayers")){
|
if(player < gameInfo.get("NumberOfPlayers")){
|
||||||
game.switchToPreviousPlayer();
|
game.switchToPreviousPlayer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int player = 1; player <= gameInfo.get("NumberOfPlayers"); player++){
|
for(int player = 1; player <= gameInfo.get("NumberOfPlayers"); player++){
|
||||||
buildStructuresInFoundingPhase(game, parser, true);
|
buildStructuresInFoundingPhase(game, parser, true);
|
||||||
game.switchToNextPlayer();
|
game.switchToNextPlayer();
|
||||||
|
|
|
@ -58,10 +58,10 @@ 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() {
|
||||||
if (activePlayer < allPlayers.size()){
|
if (activePlayer < allPlayers.size() -1){
|
||||||
activePlayer++;
|
activePlayer++;
|
||||||
}
|
}
|
||||||
else if (activePlayer == allPlayers.size()){
|
else if (activePlayer == allPlayers.size() -1){
|
||||||
activePlayer = 0;
|
activePlayer = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -220,11 +220,6 @@ public class SiedlerGame {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean buildSettlementFoundation(Point position) {
|
|
||||||
//todo implement
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds a city at the specified position on the board.
|
* Builds a city at the specified position on the board.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue