Exemplo n.º 1
0
        public void StartNewEvaluation(IBlackBox phenome, NeatGenome genome)
        {
            _worldAccessor.EnsureInitialized();

            if (_room.Map == null)
            {
                throw new ApplicationException("nooooooooope");
            }

            if (_room.Bot == null)
            {
                throw new ApplicationException("noope");
            }
        }
Exemplo n.º 2
0
        public void StartNewEvaluation(IBlackBox phenome, NeatGenome genome)
        {
            _worldAccessor.EnsureInitialized();

            #region validate

            if (_room.Map == null || _room.Bot == null || _room.BrainPart == null)
            {
                throw new ApplicationException(string.Format("_worldAccessor.EnsureInitialized didn't set everything up: _room.Map={0}, _room.Bot={1}",
                                                             _room.Map == null ? "null" : "notnull",
                                                             _room.Bot == null ? "null" : "notnull",
                                                             _room.BrainPart == null ? "null" : "notnull"));
            }

            if (_room.Bot is ArcBot2 arc)
            {
                if (arc.Weapon == null)
                {
                    throw new ApplicationException("_room.Bot needs to have a weapon attached");
                }
            }
            else
            {
                throw new ApplicationException($"_room.Bot needs to be ArcBot2: {_room.Bot.GetType()}");
            }

            #endregion

            _room.BrainPart.SetPhenome(phenome, genome, _activation, _hyperneatArgs);

            arc.PhysicsBody.Position = _room.Center;

            arc.PhysicsBody.Velocity        = new Vector3D(0, 0, 0);
            arc.PhysicsBody.Rotation        = Quaternion.Identity;
            arc.PhysicsBody.AngularVelocity = new Vector3D(0, 0, 0);

            //NOTE: Leaving the position alone.  This should help with making the brain more robust
            arc.Weapon.PhysicsBody.Velocity = new Vector3D(0, 0, 0);

            _snapshots.Clear();

            _error       = 0;
            _runningTime = 0;

            _evaluationCount++;

            _isEvaluating = true;
        }
Exemplo n.º 3
0
        public void StartNewEvaluation(IBlackBox phenome, NeatGenome genome)
        {
            _worldAccessor.EnsureInitialized();

            #region validate

            if (_room.Map == null || _room.Bot == null || _room.BrainPart == null)
            {
                throw new ApplicationException(string.Format("_worldAccessor.EnsureInitialized didn't set everything up: _room.Map={0}, _room.Bot={1}",
                                                             _room.Map == null ? "null" : "notnull",
                                                             _room.Bot == null ? "null" : "notnull",
                                                             _room.BrainPart == null ? "null" : "notnull"));
            }

            #endregion

            _room.BrainPart.SetPhenome(phenome, genome, _activation, _hyperneatArgs);

            _room.Bot.PhysicsBody.Position = _room.Center;

            // Give it an initial random kick to force it to be a bit more robust (this could backfire though, because the evaluator
            // may favor good initial conditions instead of a better brain).  If random initial settings are used, there should be
            // several tests before a final score is given
            if (_initialRandomVelocity != null)
            {
                _room.Bot.PhysicsBody.Velocity = Math3D.GetRandomVector_Spherical(_initialRandomVelocity.Value);
            }
            else
            {
                _room.Bot.PhysicsBody.Velocity = new Vector3D(0, 0, 0);
            }

            _room.Bot.PhysicsBody.Rotation        = Quaternion.Identity;
            _room.Bot.PhysicsBody.AngularVelocity = new Vector3D(0, 0, 0);

            _snapshots.Clear();

            _error       = 0;
            _runningTime = 0;

            _evaluationCount++;

            _isEvaluating = true;
        }