Exemple #1
0
        partial void test_ai_nodes_npuzzleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string test = "";

            NPuzzle p = NPuzzle.Next(4);

            p.Fitness = NPuzzle.Evaluate(p);

            NPuzzle q = new NPuzzle(null, p.ToArray());

            q.Fitness = NPuzzle.Evaluate(q);

            // tests IsEqual method
            int n = p.IsEqual(q);

            test += "\np IsEqual to q returns " + n;
            test += "\nroot:" + p.ToString();

            IList <ITreeNode> c = NPuzzle.GenerateChild(p);

            for (int i = 0; i < c.Count; i++)
            {
                c[i].Fitness = NPuzzle.Evaluate((NPuzzle)c[i]);
                test        += "\n\nchild[" + i.ToString("00") + "]:" + ((NPuzzle)c[i]).ToString();
                test        += "\np IsEqual to child[" + i.ToString("00") + "]: " + p.IsEqual(c[i]);
            }

            richTextBox.Text = test;
        }
Exemple #2
0
        partial void test_ai_core_queueToolStripMenuItem_Click(object sender, EventArgs e)
        {
            const int n = 10, s = 4;

            Queue q0 = new Queue(null);

            NPuzzle np;

            for (int i = 0; i < n; i++)
            {
                np         = NPuzzle.Next(s);
                np.Fitness = NPuzzle.Evaluate(np);
                q0.Enqueue(np);
            }

            richTextBox.Text = q0.ToString();
        }