コード例 #1
0
        public override Neuron nameCopy()
        {
            WorkingNeuron clone = new WorkingNeuron();

            clone.setName(getName());
            return(clone);
        }
コード例 #2
0
        public Creature(Vector2 pos, float viewAngle)
        {
            this.pos       = pos;
            this.viewAngle = viewAngle;

            inBias.setName(NAME_IN_BIAS);
            inFoodValuePosition.setName(NAME_IN_FOODVALUEPOSITION);
            inFoodValueFeeler.setName(NAME_IN_FOODVALUEFEELER);
            inOcclusionFeeler.setName(NAME_IN_OCCLUSIONFEELER);
            inEnergy.setName(NAME_IN_ENERGY);
            inAge.setName(NAME_IN_AGE);
            inGeneticDifference.setName(NAME_IN_GENETICDIFFERENCE);
            inWasAttacked.setName(NAME_IN_WASATTACKED);
            inWaterOnFeeler.setName(NAME_IN_WATERONFEELER);
            inWaterOnCreature.setName(NAME_IN_WATERONCREATURE);

            outBirth.setName(NAME_OUT_BIRTH);
            outRotate.setName(NAME_OUT_ROTATE);
            outForward.setName(NAME_OUT_FORWARD);
            outFeelerangle.setName(NAME_OUT_FEELERANGLE);
            outAttack.setName(NAME_OUT_ATTACK);
            outEat.setName(NAME_OUT_EAT);

            brain = new NeuralNetwork();
            brain.addInputNeuron(inBias);
            brain.addInputNeuron(inFoodValuePosition);
            brain.addInputNeuron(inFoodValueFeeler);
            brain.addInputNeuron(inOcclusionFeeler);
            brain.addInputNeuron(inEnergy);
            brain.addInputNeuron(inAge);
            brain.addInputNeuron(inGeneticDifference);
            brain.addInputNeuron(inWasAttacked);
            brain.addInputNeuron(inWaterOnFeeler);
            brain.addInputNeuron(inWaterOnCreature);

            brain.generateHiddenNeurons(10);

            brain.addOutputNeuron(outBirth);
            brain.addOutputNeuron(outRotate);
            brain.addOutputNeuron(outForward);
            brain.addOutputNeuron(outFeelerangle);
            brain.addOutputNeuron(outAttack);
            brain.addOutputNeuron(outEat);

            brain.generateFullMesh();
            brain.randomizeAllWeights();
//            CalculateFellerPos();
            color = new Color(Random.value, Random.value, Random.value);
        }