Example #1
0
        public MainWindow()
        {
            InitializeComponent();

            string FName = "qbase.dat";

            BinaryFormatter formatter = new BinaryFormatter();

            if (File.Exists(FName))
            {
                using (FileStream fs = new FileStream(FName, FileMode.OpenOrCreate))
                {
                    QLearning = (TQLearning)formatter.Deserialize(fs);
                }
            }
            else
            {
                QLearning = new TQLearning(textBox);

                using (FileStream fs = new FileStream(FName, FileMode.OpenOrCreate))
                {
                    formatter.Serialize(fs, QLearning);
                }
            }

            Base = new TBase();

            Pole = new TPole(gPole, textBox, textBox1, Base, QLearning);
        }
Example #2
0
File: TBase.cs Project: rwsh/AI-XO3
        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;
                    }
                }
            }
        }
Example #3
0
        public MainWindow()
        {
            InitializeComponent();

            Base = new TBase();

            Pole = new TPole(gPole, Base);
        }
Example #4
0
        private void cmAutoRun(object sender, RoutedEventArgs e)
        {
            Pole = new TPole(gPole, textBox, textBox1, Base, QLearning);

            rnd = new Random();

            Timer          = new DispatcherTimer();
            Timer.Tick    += new EventHandler(onTick);
            Timer.Interval = new TimeSpan(0, 0, 0, 0, 10);

            Timer.Start();
        }
Example #5
0
 private void cmRun(object sender, RoutedEventArgs e)
 {
     Pole = new TPole(gPole, Base);
 }
Example #6
0
 private void cmRun(object sender, RoutedEventArgs e)
 {
     Pole = new TPole(gPole, textBox, textBox1, Base, QLearning);
 }