public GenomeDisplayer() { _width = 500; _height = 500; _image = new Bitmap(_width, _height); _viewportPainter = new IOGraphViewportPainter(new IOGraphPainter()); _viewportArea = new Rectangle(0, 0, _width, _height); _factory = new NetworkGraphFactory(); }
void Run() { //preparing Console Console.Clear(); Console.CursorVisible = false; _drawer = new ConsoleDrawing(); ConsoleDrawing.ShowControls(); form = new Form(); form.Width = 1920; form.Height = 1080; graphViewportPainter = new IOGraphViewportPainter(new IOGraphPainter()); graphControl = new GraphControl(); graphControl.ViewportPainter = graphViewportPainter; graphControl.Width = form.Width; graphControl.Height = form.Height; form.Controls.Add(graphControl); form.Show(); form.Visible = false; tetrisAI = new TetrisAI(this, (x) => { if (++saveCount >= 20) { saveCount = 0; Task.Run(() => form.Invoke((MethodInvoker) delegate { tetrisAI.Save(); Console.WriteLine("Network saved!"); })); } }, HandleNewBestNetwork, File.Exists("SavedProgress.xml")); tetrisAI.StartTraining(); Task.Run(() => { while (KeyPressedHandler(Console.ReadKey())) { ; } form.Invoke((MethodInvoker) delegate { form.Close(); }); }); form.ShowDialog(); tetrisAI.StopTraining(); tetrisAI.Save(); Console.ResetColor(); Console.CursorVisible = true; }
/// <summary> /// Default constructor. /// </summary> public NeatGenomeView() { InitializeComponent(); graphControl1.ViewportPainter = _viewportPainter = new IOGraphViewportPainter(new IOGraphPainter()); }
/// <summary> /// Construct with the provided CPPN activation function library to draw CPPNs with (genome nodes contain an index into this library). /// </summary> /// <param name="actFnLib"></param> public CppnGenomeView(IActivationFunctionLibrary actFnLib) { InitializeComponent(); graphControl1.ViewportPainter = _viewportPainter = new IOGraphViewportPainter(new CppnGraphPainter(actFnLib)); }