コード例 #1
0
        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;
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        CreationFrame create(String word, int frame)
        {
            Neuron neuron = neurons.Find(i => i.Word == word);

            if (neuron == null)
            {
                neuron = new Neuron(word, alpha, beta);
                neurons.Add(neuron);

                Receptor receptor = new Receptor();
                Synapse  synapse  = new Synapse(receptor, neuron);

                synapses.Add(synapse);
                receptors.Add(receptor);
                receptor.Output = synapse;
            }

            neuron.Count++;
            return(new CreationFrame(neuron, frame));
        }
コード例 #4
0
ファイル: Synapse.cs プロジェクト: Grzesiaczek/Brain
 public Synapse(Receptor pre, Neuron post)
 {
     this.pre  = pre;
     this.post = post;
     initialize();
 }
コード例 #5
0
ファイル: SequenceReceptor.cs プロジェクト: Grzesiaczek/Brain
 public SequenceReceptor(Sequence sequence, Receptor receptor) : base(receptor.Name)
 {
     this.receptor = receptor;
     sequence.add(this);
     changeType(SequenceElementType.Receptor);
 }