public static Stage Load(StageEditor editor, JObject obj) { var stage = new Stage(); stage.Deserialize(editor, obj); return(stage); }
public JObject Serialize(StageEditor editor) { var obj = editor.Serialize(); obj["Inputs"] = JArray.FromObject(inputNeurons.Select(n => n.ID)); obj["Outputs"] = JArray.FromObject(outputNeurons.Select(n => n.ID)); obj["TestCases"] = JArray.FromObject(cases.Select(c => c.Serialize())); return(obj); }
protected void Deserialize(StageEditor editor, JObject obj) { cases = obj["TestCases"].Select(t => TestCase.Deserialize(t)).ToArray(); inputLength = curCase.Inputs[0].Length; outputLength = curCase.Outputs[0].Length; editor.DeserializeParts(JArray.FromObject(obj["Parts"]), out var orgIds, out var newIds); foreach (uint i in obj["Inputs"]) { SetInputNeuron(editor.FromID(newIds[Array.IndexOf(orgIds, i)]) as BasicNeuron); } foreach (uint i in obj["Outputs"]) { SetOutputNeuron(editor.FromID(newIds[Array.IndexOf(orgIds, i)]) as BasicNeuron); } outputStack = new List <bool> [curCase.Outputs.Length]; for (int i = 0; i < curCase.Outputs.Length; i++) { outputStack[i] = new List <bool>(); } curTester = new Tester(curCase); Visualizer.Tester = curTester; }
public static Stage New(StageEditor editor) { var stage = new Stage(); return(stage); }