Пример #1
0
        public void StartGame(IAi aiModule)
        {
            _ai = aiModule;
            //use the aiModule to calculate the computer movements.
            _model = new Logic();

            // nézemodell létrehozása
            _viewModel            = new TicTacToeViewModel(_model);
            _viewModel.GameEnded += GameEnded;
            _viewModel.CpuStep   += CpuStep;

            // nézet létrehozása
            _view             = new MainWindow();
            _view.DataContext = _viewModel;
            _view.Show();

            Testing     test     = new Testing();
            UnitTesting unitTest = new UnitTesting();
        }
Пример #2
0
    static void test_aux(MINMAX M_W, MINMAX M_B, bool testFirst)
    {
        /* System.Console.WriteLine();
         * System.Console.WriteLine("=======================================================");
         * System.Console.WriteLine();
         * M_W.printConfigs();
         * System.Console.WriteLine("       --- --- ---VS --- --- ---");
         * M_B.printConfigs();
         * System.Console.WriteLine(" ---  --- --- --- --- --- --- ---");
         * System.Console.WriteLine("from start");
         * int[] test_start = UnitTesting.testHeuristic(number_of_games_div4_pertest * 2, M_W, M_B, testFirst, true, false, false);
         * System.Console.WriteLine("from mid game");
         * int[] test_mid = UnitTesting.testHeuristic(testBoards, M_W, M_B, testFirst, true, false, false);
         *
         * Console.WriteLine("TOTAL "
         + "W = " + (test_start[0] + test_mid[0])
         + "   L = " + (test_start[1] + test_mid[1])
         + "   D = " + (test_start[2] + test_mid[2])
         +   )
         +   ;*/
        System.Console.WriteLine();

        int[] test_start = UnitTesting.testHeuristic(number_of_games_div4_pertest * 2, M_W, M_B, testFirst, true, false, false);
        int[] test_mid   = UnitTesting.testHeuristic(testBoards, M_W, M_B, testFirst, true, false, false);

        String names;

        if (testFirst)
        {
            names = "\\cellcolor{blue!15}\\textbf{" + ((Pentago_Rules)M_W.rules).getHeurName() + "} & " + ((Pentago_Rules)M_B.rules).getHeurName();
        }
        else
        {
            names = names = ((Pentago_Rules)M_W.rules).getHeurName() + " & \\cellcolor{blue!15}\\textbf{" + ((Pentago_Rules)M_B.rules).getHeurName() + "}";
        }
        Console.WriteLine(names + "& {\\color[HTML]{00009B} } & {\\color[HTML]{9A0000} } & {\\color[HTML]{009901} } &  & {\\color[HTML]{00009B} } & {\\color[HTML]{9A0000} } & {\\color[HTML]{009901} } &  & {\\color[HTML]{00009B} } & {\\color[HTML]{9A0000} } & {\\color[HTML]{009901} } &  \\\\ ");//\\cline{1-2}");
        Console.WriteLine((testFirst ? "\\cellcolor{ blue!15}" : "") + ((Pentago_Rules)M_W.rules).getHeurConfigs() + " & " + (!testFirst ? "\\cellcolor{ blue!15}" : "") + ((Pentago_Rules)M_B.rules).getHeurConfigs()
                          + " & \\multirow{-2}{*}{{\\color[HTML]{00009B} " + test_start[0] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{{\\color[HTML]{9A0000} " + test_start[1] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{{\\color[HTML]{009901} " + test_start[2] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{" + test_start[3] + "} & \\multirow{-2}{*}{{\\color[HTML]{00009B} " + test_mid[0] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{{\\color[HTML]{9A0000} " + test_mid[1] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{{\\color[HTML]{009901} " + test_mid[2] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{" + test_mid[3] + "} & \\multirow{-2}{*}{{\\color[HTML]{00009B} " + (test_start[0] + test_mid[0]) * 1000 / (number_of_games_div4_pertest * 4) + "}} & \\multirow{-2}{*}{{\\color[HTML]{9A0000} " + (test_start[1] + test_mid[1]) * 1000 / (number_of_games_div4_pertest * 4) + "}} & \\multirow{-2}{*}{{\\color[HTML]{009901} " + (test_start[2] + test_mid[2]) * 1000 / (number_of_games_div4_pertest * 4) + "}} & \\multirow{-2}{*}{" + (test_start[3] + test_mid[3]) / 2 + "} \\\\ \\hline");
        //Console.WriteLine(12 + " & " + 12 + " & \\multirow{-2}{*}{{\\color[HTML]{00009B} " + test_start[0] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{{\\color[HTML]{9A0000} " + test_start[1] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{{\\color[HTML]{009901} " + test_start[2] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{" + test_start[3] + "} & \\multirow{-2}{*}{{\\color[HTML]{00009B} " + test_mid[0] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{{\\color[HTML]{9A0000} " + test_mid[1] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{{\\color[HTML]{009901} " + test_mid[2] * 1000 / (number_of_games_div4_pertest * 2) + "}} & \\multirow{-2}{*}{" + test_mid[3] + "} & \\multirow{-2}{*}{{\\color[HTML]{00009B} " + (test_start[0] + test_mid[0]) * 1000 / (number_of_games_div4_pertest * 4) + "}} & \\multirow{-2}{*}{{\\color[HTML]{9A0000} " + (test_start[1] + test_mid[1]) * 1000 / (number_of_games_div4_pertest * 4) + "}} & \\multirow{-2}{*}{{\\color[HTML]{009901} " + (test_start[2] + test_mid[2]) * 1000 / (number_of_games_div4_pertest * 4) + "}} & \\multirow{-2}{*}{" + (test_start[3] + test_mid[3]) / 2 + "} \\\\ \\hline");
    }
Пример #3
0
 public static void Initialise(TestContext _)
 {
     UnitTesting.SetupUnitTests();
 }