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); }
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; } } } }
public MainWindow() { InitializeComponent(); Base = new TBase(); Pole = new TPole(gPole, Base); }
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(); }
private void cmRun(object sender, RoutedEventArgs e) { Pole = new TPole(gPole, Base); }
private void cmRun(object sender, RoutedEventArgs e) { Pole = new TPole(gPole, textBox, textBox1, Base, QLearning); }