public void SingleSolution() { CurrentState state = new CurrentState(); IDecision[] decisions = new IDecision[] { new MoveToFridge(state), new KillFridgeGuardian(state), new OpenFridgeDecision(state), new GetBananaFromFridge(state) }; Planner planner = new Planner(StateOffset.Heuristic); for (int i = 0; i < decisions.Length; i++) { planner.AddDecision(decisions[i]); } StateOffset goal = new StateOffset(); goal.Set("HasBanana", true); Queue<IDecision> plan = planner.CreatePlan(goal); Assert.Greater(plan.Count, 0); Assert.AreSame(decisions[0], plan.Dequeue()); // MoveToFridge Assert.AreSame(decisions[1], plan.Dequeue()); // KillFridgeGuardian Assert.AreSame(decisions[1], plan.Dequeue()); // KillFridgeGUardian Assert.AreSame(decisions[1], plan.Dequeue()); // KillFridgeGuardian Assert.AreSame(decisions[2], plan.Dequeue()); // OpenFridge Assert.AreSame(decisions[3], plan.Dequeue()); // GetBananaFromFridge }
public SquadUnit(Combatant unit) { Unit = unit; Goal = new StateOffset(); IsManual = true; Planner = new Planner(StateOffset.Heuristic); }
private Planner BasicPlanner() { CurrentState state = new CurrentState(); IDecision[] decisions = new IDecision[] { new MoveToFridge(state), new KillFridgeGuardian(state), new OpenFridgeDecision(state), new GetBananaFromFridge(state) }; Planner planner = new Planner(StateOffset.Heuristic); for (int i = 0; i < decisions.Length; i++) { planner.AddDecision(decisions[i]); } return planner; }