void Window(int ID) // interface window { bool SV = false; Reload = false; if (WindowRect.height == 80) // small window { if (GUI.Button(new Rect(WindowRect.width - 20, 0, 20, 20), "+")) // change window scale { WindowRect.width = 400; WindowRect.height = 260; WindowRect.x = WindowRect.x; } ShowVisualization = IGUI.Button(1, 2, "Visualization OFF", "Visualization ON", ShowVisualization, ref SV); // perceptron's visualization (ON / OFF) } else // big window { if (GUI.Button(new Rect(WindowRect.width - 20, 0, 20, 20), "-")) // change window scale { WindowRect.width = 200; WindowRect.height = 80; WindowRect.x = WindowRect.x; } PerceptronBackPropagationInterface PBPI = gameObject.GetComponent <PerceptronBackPropagationInterface>(); if (PBPI != null) { if (PBPI.Learn) { GUI.enabled = false; // disable GUI if GO have lerning interface and perceptron is study } } PerceptronRandomGenerationInterface PRGI = gameObject.GetComponent <PerceptronRandomGenerationInterface>(); if (PRGI != null) { if (PRGI.Learn) { GUI.enabled = false; // disable GUI if GO have lerning interface and perceptron is study } } PCT.AFWM = IGUI.Button(1, 2, "Without Minus", "With Minus", PCT.AFWM, ref Reload); PCT.B = IGUI.Button(1, 3, "Bias OFF", "Bias ON", PCT.B, ref Reload); PCT.AFS = IGUI.HorizontalSlider(1, 4, "Scale", PCT.AFS, 0.1F, 5F, ref Reload); Enters = IGUI.IntArrows(1, 5, "Enters", false, Enters, 1, true, 0); Layers = IGUI.IntArrows(1, 6, "Layers", false, PCT.NIHL.Length, 0, true, 0, ref Reload); if (Enters != PCT.Input.Length && !PCT.B) { Reload = true; } else if (Enters != PCT.Input.Length - 1 && PCT.B) { Reload = true; } if (Reload) { LayersModification(); // create new array of hiden layer } if (Layers != 0) { SelectLayer = IGUI.IntArrows(1, 7, "Select Layer", true, SelectLayer, 0, false, Layers - 1); Layer[SelectLayer] = IGUI.IntArrows(1, 8, "Neurons in layer", false, Layer[SelectLayer], 1, true, 0, ref Reload); } GUI.enabled = true; IGUI.Info(2, 5, "Exits", PCT.Output.Length); ShowVisualization = IGUI.Button(2, 2, "Visualization OFF", "Visualization ON", ShowVisualization, ref SV); // perceptron's visualization (ON / OFF) PerceptronName = GUI.TextField(new Rect(200, 160, 180, 30), PerceptronName); bool Save = false; Save = IGUI.Button(2, 7, "Save", "Save", Save); bool Load = false; Load = IGUI.Button(2, 8, "Load", "Load", Load); if (Save) { PCT.Save(PerceptronName); } else if (Load) { PCT.Load(PerceptronName); Layers = PCT.NIHL.Length; Layer = new Formulas().FromArray(PCT.NIHL); if (PCT.B) { Enters = PCT.Input.Length - 1; int i = 0; while (i < Layers) { Layer[i]--; i++; } } else { Enters = PCT.Input.Length; } if (PV != null) { PV.DestroyPerceptronModel(); PV.PCT = PCT; PV.CreatePerceptronModel(false, 0, 0); } } } if (Reload) { if (PV != null) { PV.DestroyPerceptronModel(); } PCT.CreatePerceptron(PCT.AFS, PCT.B, PCT.AFWM, Enters, Layer, PCT.Output.Length); // create perceptron } if (SV || (ShowVisualization && Reload)) { if (ShowVisualization) // for perceptron's visualization { if (PV == null) { PV = new PerceptronVisualization(); } PV.PCT = PCT; PV.CreatePerceptronModel(false, 0, 0); } else { if (PV != null) { PV.DestroyPerceptronModel(); PV = null; } } } if (WindowRect.x < 0) //window restriction on the screen { WindowRect.x = 0; } else if (WindowRect.x + WindowRect.width > Screen.width) { WindowRect.x = Screen.width - WindowRect.width; } if (WindowRect.y < 0) { WindowRect.y = 0; } else if (WindowRect.y + WindowRect.height > Screen.height) { WindowRect.y = Screen.height - WindowRect.height; } GUI.DragWindow(new Rect(0, 0, WindowRect.width, 20)); }
void Window(int ID) // interface window { if (WindowRect.height == 80) // small window { if (GUI.Button(new Rect(WindowRect.width - 20, 0, 20, 20), "+")) // change window scale { WindowRect.width = 400; WindowRect.height = 260; WindowRect.x = WindowRect.x - 200; } bool Activte = false; Learn = IGUI.Button(1, 2, "Learn OFF", "Learn ON", Learn, ref Activte); if (Activte && !Learn) { PLBRG.StopLearn(PCT); } } else // big window { if (GUI.Button(new Rect(WindowRect.width - 20, 0, 20, 20), "-")) // change window scale { WindowRect.width = 200; WindowRect.height = 80; WindowRect.x = WindowRect.x + 200; } if (Learn) { GUI.enabled = false; } PLBRG.AmountOfChildren = IGUI.IntArrows(1, 2, "Children amount", false, PLBRG.AmountOfChildren, 1, true, 0); PLBRG.ChildrenDifference = IGUI.HorizontalSlider(1, 3, "Children difference", PLBRG.ChildrenDifference, 0.01F, 10F); PLBRG.ChildrenGradient = IGUI.Button(1, 4, "Children gradient OFF", "Children gradient ON", PLBRG.ChildrenGradient); PLBRG.GenerationEffect = IGUI.HorizontalSlider(1, 5, "Generation effect", PLBRG.GenerationEffect, 0F, 1F); PLBRG.GenerationSplashEffect = IGUI.HorizontalSlider(1, 6, "Splash effect coefficient", PLBRG.GenerationSplashEffect, 0F, 1F); PLBRG.ChanceCoefficient = IGUI.HorizontalSlider(1, 7, "Chance coefficient", PLBRG.ChanceCoefficient, 0F, 0.5F); GUI.enabled = true; bool Activte = false; Learn = IGUI.Button(1, 8, "Learn OFF", "Learn ON", Learn, ref Activte); if (Activte && !Learn) { PLBRG.StopLearn(PCT); } IGUI.Info(2, 2, "Best generation", PLBRG.BestGeneration); IGUI.Info(2, 3, "Generation", PLBRG.Generation); IGUI.Info(2, 4, "Children", PLBRG.ChildrenInGeneration); IGUI.Info(2, 5, "Best longevity", PLBRG.BestLongevity); if (PLBRG.GenerationSplashEffect != 0 || PLBRG.GenerationEffect != 0) { IGUI.InfoF2(2, 6, "Children difference", PLBRG.ChildrenDifferenceAfterEffects); } if (PLBRG.ChanceCoefficient != 0) { IGUI.Info(2, 7, "Chance", PLBRG.Chance); } } if (WindowRect.x < 0) //window restriction on the screen { WindowRect.x = 0; } else if (WindowRect.x + WindowRect.width > Screen.width) { WindowRect.x = Screen.width - WindowRect.width; } if (WindowRect.y < 0) { WindowRect.y = 0; } else if (WindowRect.y + WindowRect.height > Screen.height) { WindowRect.y = Screen.height - WindowRect.height; } GUI.DragWindow(new Rect(0, 0, WindowRect.width, 20)); }