+ Properties ps = gameManager.getGameParameters();
+ String buf = ps.getProperty("roadLength");
+ if (buf != null) {
+ try {
+ int i = Integer.parseInt(buf);
+ if (i < 0 || i > 20 || (i & 1) != 0) {
+ gameManager.addToGameSummary(GameManager.formatErrorMessage("Ignoring invalid road length: " + buf));
+ }
+ else {
+ roadLength = i;
+ gameManager.addToGameSummary("Road length overridden to " + i);
+ }
+ }
+ catch(NumberFormatException e) {
+ gameManager.addToGameSummary(GameManager.formatErrorMessage("Ill-formed road length: " + buf));
+ }
+ }
+ ps.setProperty("roadLength", new Integer(roadLength).toString());
+
+ buf = ps.getProperty("initialStones");
+ if (buf != null) {
+ try {
+ int i = Integer.parseInt(buf);
+ if (i > 50) {
+ gameManager.addToGameSummary(GameManager.formatErrorMessage("Ignoring invalid initial stone count: " + buf));
+ }
+ else {
+ initialStones = i;
+ gameManager.addToGameSummary("Initial stone count overridden to " + buf);
+ }
+ }
+ catch (NumberFormatException e) {
+ gameManager.addToGameSummary(GameManager.formatErrorMessage("Ill-formed initial stone count: " + buf));
+ }
+ }
+ ps.setProperty("initialStones", new Integer(initialStones).toString());
+