コード例 #1
0
        public ResultsWindow(Stats stat, List<Node> results, EightSquares eightPuzzle, int expanded, int total)
        {
            InitializeComponent();
            this.eightPuzzle = eightPuzzle;
            this.stat = stat;
            expandedCount.Text += expanded;
            genCount.Text += total;
            movesMade.Text += results.Last().gValue;
            avgBranchingFactor.Text += Math.Round((Double)total / expanded, 3);
            Double temp = (double)1 / (double)results.Last().gValue;
            effBranchingFactor.Text += Math.Round(Math.Pow(expanded, temp), 3);
            List<Data> source = new List<Data>();
            foreach (Node n in results)
            {
                source.Add(new Data()
                {
                    hValue = n.hValue,
                    gValue = n.gValue,
                    fValue = n.fValue,
                    action = n.action,
                    state = stringifyState(n),
                    thisNode = n
                });

                actionsToGoal.Text += (n.action != String.Empty && n.gValue != results.Count - 1) ? String.Format("{0}, ", n.action) : n.action;
            }
            grid.ItemsSource = source;
            //grid.DataContext = results[0];
        }
コード例 #2
0
 private void initializeStats()
 {
     stats = new Stats();
     optionsContainer.DataContext = stats;
     stats.misplacedTile = Heuristics.misplacedTileHeuristic(currentNode);
     stats.manhattanDistance = Heuristics.manhattanDistanceHeuristic(currentNode);
     stats.manhattanDistancePlusReversal = Heuristics.manhattanDistanceHeuristicPlusReversalPenalty(currentNode);
 }