public AnimatedReceptor(Receptor r, AnimatedNeuron n, int wall) { receptor = r; neuron = n; this.wall = wall; radius = Constant.Radius * 2 / 3; //0-góra, 1-lewo, 2-prawo, 3-dół switch (wall) { case 0: circle = new Circle(new PointF(n.Position.X, 0), radius); n.Position = new PointF(n.Position.X, 2 * Constant.Radius); break; case 1: circle = new Circle(new PointF(0, n.Position.Y), radius); n.Position = new PointF(2 * Constant.Radius, n.Position.Y); break; case 2: circle = new Circle(new PointF(size.Width - 1, n.Position.Y), radius); n.Position = new PointF(2 * Constant.Radius, n.Position.Y); break; case 3: circle = new Circle(new PointF(n.Position.X, size.Height - 1), radius); n.Position = new PointF(n.Position.X, 2 * Constant.Radius); break; } position = circle.Center; }
public void addQuery(String[] words, int interval, float intensivity) { int index = 0; frame = 0; frameChanged(frame, null); query.clear(); foreach (String word in words) { AnimatedNeuron an = neurons.Find(k => k.Name == word); if (an == null) { continue; } Receptor receptor = brain.Receptors.Find(k => k.Name == word); Synapse synapse = brain.Synapses.Find(k => k.Pre == receptor); receptor.initialize(interval, interval - index - 1, intensivity); new SequenceReceptor(query, receptor); AnimatedReceptor ar = new AnimatedReceptor(receptor, an, index++ % 4); synapses.Add(new AnimatedSynapse(ar, an, synapse)); receptors.Add(ar); } query.arrange(); }
public Dictionary <object, object> loadFrame(CreationFrame frame, int index) { Dictionary <object, object> result = new Dictionary <object, object>(); Random random = new Random(); bool added = false; Neuron neuron = frame.Neuron.Neuron; if (neurons.Find(k => k.Neuron == neuron) == null) { PointF position = randomPoint(random); AnimatedNeuron an = new AnimatedNeuron(neuron, position); CreatedNeuron cn = new CreatedNeuron(an); neurons.Add(an); result.Add(neuron, cn); added = true; } else { result.Add(neuron, true); } foreach (CreationData data in frame.Data) { if (data.Synapse.Changes.First <CreationData>() == data) { AnimatedNeuron pre = neurons.Find(k => data.Synapse.Pre == k.Neuron); AnimatedNeuron post = neurons.Find(k => data.Synapse.Post == k.Neuron); AnimatedSynapse synapse = synapses.Find(k => pre == k.Pre && post == k.Post); if (synapse == null) { AnimatedSynapse syn = new AnimatedSynapse(pre, post, data.Synapse); CreatedSynapse cs = new CreatedSynapse(syn); synapses.Add(syn); result.Add(syn.Synapse, cs); if (syn.isDuplex()) { result.Add(syn.Duplex, cs); } } else { synapse.setDuplex(data.Synapse); } } } if (added) { balance(); } return(result); }
public ShiftedNeuron(AnimatedNeuron neuron, PointF click, List <AnimatedNeuron> neurons) { this.click = click; this.neuron = neuron; this.neurons = neurons; shift = new PointF(); original = new PointF(neuron.Position.X, neuron.Position.Y); neuron.activate(true); moved = false; }
public AnimatedSynapse(AnimatedNeuron pre, AnimatedNeuron post, Synapse syn) { this.pre = pre; this.post = post; duplex = null; vector = new AnimatedVector(pre, post); synapse = new AnimatedState(syn, vector); pre.Output.Add(this); post.Input.Add(this); changePosition(); }
public BalancedNeuron(AnimatedNeuron neuron) { this.neuron = neuron; shift = new PointF(0, 0); position = new PointF(neuron.Position.X, neuron.Position.Y); input = new List <AnimatedVector>(); output = new List <AnimatedVector>(); vectors = new List <AnimatedVector>(); foreach (AnimatedSynapse synapse in neuron.Input) { input.Add(synapse.Vector); } foreach (AnimatedSynapse synapse in neuron.Output) { output.Add(synapse.Vector); } }
public CreatedNeuron(AnimatedNeuron neuron) { this.neuron = neuron; created = false; }