package org.luxons.sevenwonders.game;

import java.util.Random;

import org.luxons.sevenwonders.game.wonders.WonderSide;

public class Settings {

    private int nbPlayers = 4;

    private int initialGold = 3;

    private int defaultTradingCost = 2;

    private WonderSide wonderSide = WonderSide.A;

    private Integer nbGuildCards = null;

    private long randomSeedForTests = 0;

    public int getNbPlayers() {
        return nbPlayers;
    }

    public void setNbPlayers(int nbPlayers) {
        this.nbPlayers = nbPlayers;
    }

    public int getInitialGold() {
        return initialGold;
    }

    public void setInitialGold(int initialGold) {
        this.initialGold = initialGold;
    }

    public int getDefaultTradingCost() {
        return defaultTradingCost;
    }

    public void setDefaultTradingCost(int defaultTradingCost) {
        this.defaultTradingCost = defaultTradingCost;
    }

    public WonderSide getWonderSide() {
        return wonderSide;
    }

    public void setWonderSide(WonderSide wonderSide) {
        this.wonderSide = wonderSide;
    }

    public int getNbGuildCards() {
        return nbGuildCards == null ? nbPlayers + 2 : nbGuildCards;
    }

    public void setNbGuildCards(int nbGuildCards) {
        this.nbGuildCards = nbGuildCards;
    }

    public long getRandomSeedForTests() {
        return randomSeedForTests;
    }

    public void setRandomSeedForTests(long randomSeedForTests) {
        this.randomSeedForTests = randomSeedForTests;
    }

    public Random getRandom() {
        return new Random(randomSeedForTests);
    }
}

@@ -172,9 +172,10 @@
 s = 
-4
+-1
 ;%0A%0A 
@@ -299,16 +299,53 @@
 ide.A;%0A%0A
+    // will default to nbPlayers + 2%0A
     priv
@@ -420,16 +420,16 @@
 s = 0;%0A%0A
-
     publ
@@ -448,24 +448,158 @@
 Players() %7B%0A
+        if (nbPlayers %3C 0) %7B%0A            throw new IllegalStateException(%22The number of players has not been initialized%22);%0A        %7D%0A
         retu
@@ -1329,25 +1329,28 @@
  null ? 
-n
+getN
 bPlayers
  + 2 : n
@@ -1337,24 +1337,26 @@
 getNbPlayers
+()
  + 2 : nbGui

Fix default nbPlayers in the settings