Exemple #1
0
        void Run()
        {
            //Base.Run(this); // Ход Машины

            string s = Pos.GetS();

            int[] As = QL.Get_As(s);

            if (As.Count() == 0)
            {
                return;
            }

            double q;

            int a = QL.Get_A(s, 0.1, out q);

            int[] ij = Pos.Get_ij(a); // !!!!!!!!!

            TPosition P = PreMove(ij[0], ij[1]);

            // int[] ix = new int[4]; /////!!!!!!!!!!!

            double r = 0;

            TAnalysis Analysis = new TAnalysis();

            ActionType Res = Analysis.WhatResult2(P);

            if (Res == ActionType.Win)
            {
                r = 10;
            }

            if (Res == ActionType.Def)
            {
                r = -10;
            }

            tb.Text = r.ToString();

            /*
             *          Result Res = P.Who(out ix[0], out ix[1], out ix[2], out ix[3]);
             *
             *
             *          if (Res == Result.X)
             *          {
             *              r = -10;
             *          }
             *
             *          if (Res == Result.O)
             *          {
             *              r = 10;
             *          }
             */

            QL.Update_Q(s, a, r, P.GetS(), 0.1, 0.9);

            Move(ij[0], ij[1]);
        }
Exemple #2
0
        public void Run(TPole Pole)
        {
            TAnalysis Analysis = new TAnalysis();

            TAnalysisRes Res = Analysis.What(Pole.Pos);

            if (Res.Act != ActionType.Nil)
            {
                if (Pole.Move(Res.Coord.i, Res.Coord.j) != Result.Error)
                {
                    return;
                }
            }

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    if (Pole.Move(i, j) != Result.Error)
                    {
                        return;
                    }
                }
            }
        }