package dungeonmania.goals;
import org.json.JSONArray;
import org.json.JSONObject;
Copyright By Assignmentchef assignmentchef
public class GoalFactory {
public static Goal createGoal(JSONObject jsonGoal, JSONObject config) {
JSONArray subgoals;
switch (jsonGoal.getString(goal)) {
case AND:
subgoals = jsonGoal.getJSONArray(subgoals);
return new Goal(
createGoal(subgoals.getJSONObject(0), config),
createGoal(subgoals.getJSONObject(1), config)
case OR:
subgoals = jsonGoal.getJSONArray(subgoals);
return new Goal(
createGoal(subgoals.getJSONObject(0), config),
createGoal(subgoals.getJSONObject(1), config)
case exit:
return new Goal(exit);
case boulders:
return new Goal(boulders);
case treasure:
int treasureGoal = config.optInt(treasure_goal, 1);
return new Goal(treasure, treasureGoal);
return null;
CS: assignmentchef QQ: 1823890830 Email: [email protected]
Reviews
There are no reviews yet.