Esempio n. 1
0
        void addChildrenToOpenSet(TreeDictionary<double, StateNode> dict,
            StateNode parent, GameState state, CombinedHeuristic heuristic)
        {
            var parentScore = stateNodeScorer (heuristic, parent);
            foreach (var input in Input.All.CartesianProduct(Input.All)) {
                var stateNode = new StateNode (parent, input, state);

            //                var target1 = state.Goal;
            //                var target2 = state.Goal;

                var targets = heuristic.cpas.NextPlatform (state.P1, state.P2, state.Goal, state.Goal);
                var target1 = targets.Item1;
                var target2 = targets.Item2;

                var score = parentScore +
                    heuristic.EstimateScore (state, input.Item1, input.Item2,
                        target1.Target, target2.Target);

                var noiseyScore = AStar.addNoise (score);
                dict.Add (noiseyScore, stateNode);
            }
        }
Esempio n. 2
0
 public CombinedAi(GameState state)
 {
     this.heuristic = new CombinedHeuristic (state);
     this.forwardModel = new ForwardModel(state);
     this.allPaths = new TreeDictionary<double, StateNode> ();
 }
Esempio n. 3
0
        protected static double stateNodeScorer(CombinedHeuristic heuristic, StateNode node)
        {
            double h = heuristic.Score (node.Value);

            h += pathScore (node);

            //            h += .1f * node.Depth(); // discourage long paths

            return (float)h;
        }