void addMap(Dictionary <object, object> map) { foreach (object key in map.Keys) { if (map[key] is bool) { CreatedNeuron neuron = mapNeurons[(Neuron)key]; neurons.Add(neuron); neuron.create(); if (count < neuron.Frame) { neuron.Frame = count; } } else if (key is Neuron) { CreatedNeuron neuron = (CreatedNeuron)(map[key]); mapNeurons.Add((Neuron)key, neuron); neurons.Add(neuron); neuron.create(); neuron.Frame = count; } else { CreatedSynapse synapse = (CreatedSynapse)(map[key]); mapSynapses.Add((Synapse)key, synapse); synapses.Add(synapse); } } }
public void create(List <CreatedNeuron> lcn, List <CreatedSynapse> lcs) { CreatedNeuron cn = neurons[neuron.Neuron]; if (!cn.Created) { cn.Frame = frame; cn.create(); lcn.Add(cn); } foreach (Synapse synapse in created) { lcs.Add(synapses[synapse]); } }
public void tick() { float factor = (float)count / interval; switch (phase) { case 1: if (neurons[neuron.Neuron].Created) { phase = 2; } else { neurons[neuron.Neuron].draw(factor); } break; case 2: if (created.Count == 0) { phase = 3; } foreach (Synapse s in created) { synapses[s].draw(factor); } break; case 3: foreach (CreationData cd in data) { CreatedSynapse cs = synapses[cd.Synapse]; cs.tick(cd); } break; } if (++count == interval) { switch (phase++) { case 1: if (synapses.Count == 0) { phase++; } CreatedNeuron cn = neurons[neuron.Neuron]; cn.create(); cn.Frame = frame; finish(cn, null); break; case 2: finish(created, null); break; case 3: create(); finish(this, null); break; } count = 0; } }