コード例 #1
0
 public APP(ILogger logger, IInputMapper inputMapperService, IReaderService readerService, IWriterService writerService)
 {
     this._writerService     = writerService;
     this._readerService     = readerService;
     this._logger            = logger;
     this._inputMaperService = inputMapperService;
 }
コード例 #2
0
 public SnakeGameEvaluatorSmart(SimpleSnakeWorldParams _swparams, IInputMapper _inputMapper, IOutputMapper _outputMapper, int _trialsPerEvaluation, int _maxTicksWithoutEating)
 {
     this._swparams              = _swparams;
     this._inputMapper           = _inputMapper;
     this._outputMapper          = _outputMapper;
     this._trialsPerEvaluation   = _trialsPerEvaluation;
     this._maxTicksWithoutEating = _maxTicksWithoutEating;
 }
コード例 #3
0
        public SnakeRunnerSmart(SimpleSnakeWorld sw, IBlackBox phenome, IInputMapper inputMapper, IOutputMapper outputMapper, int _msBetweenTicks, int _maxTicksWithoutScoreChange)
        {
            this._sw                         = sw;
            this.Phenome                     = phenome;
            this._msBetweenTicks             = _msBetweenTicks;
            this._maxTicksWithoutScoreChange = _maxTicksWithoutScoreChange;

            _inputMapper  = inputMapper;
            _outputMapper = outputMapper;
        }
コード例 #4
0
 public AnarchyInputFeed(
     OverlayConnection overlayConnection,
     IInputHoldTiming inputHoldTiming,
     IInputMapper inputMapper,
     InputBufferQueue <QueuedInput> inputBufferQueue,
     float fps)
 {
     _overlayConnection = overlayConnection;
     _inputHoldTiming   = inputHoldTiming;
     _inputMapper       = inputMapper;
     _inputBufferQueue  = inputBufferQueue;
     _fps = fps;
 }
コード例 #5
0
        private AnarchyInputFeed CreateInputFeedFromConfig(InputConfig config)
        {
            IInputMapper     inputMapper     = CreateInputMapperFromConfig(config);
            IInputHoldTiming inputHoldTiming = CreateInputHoldTimingFromConfig(config);

            _inputBufferQueue.SetNewConfig(CreateBufferConfig(config));

            return(new AnarchyInputFeed(
                       _overlayConnection,
                       inputHoldTiming,
                       inputMapper,
                       _inputBufferQueue,
                       config.FramesPerSecond));
        }
コード例 #6
0
        /// <summary>
        /// Initialize the experiment with some optional XML configutation data.
        /// </summary>
        public void Initialize(string name, XmlElement xmlConfig)
        {
            _name                    = name;
            _populationSize          = XmlUtils.GetValueAsInt(xmlConfig, "PopulationSize");
            _specieCount             = XmlUtils.GetValueAsInt(xmlConfig, "SpecieCount");
            _activationScheme        = ExperimentUtils.CreateActivationScheme(xmlConfig, "Activation");
            _complexityRegulationStr = XmlUtils.TryGetValueAsString(xmlConfig, "ComplexityRegulationStrategy");
            _complexityThreshold     = XmlUtils.TryGetValueAsInt(xmlConfig, "ComplexityThreshold");

            //snake specific params
            _swparams = SnakeUtils.GetParamsFromXml(xmlConfig);

            _trialsPerEvaluation   = XmlUtils.TryGetValueAsInt(xmlConfig, "TrialsPerEvaluation") ?? _trialsPerEvaluation;
            _maxTicksWithoutEating = XmlUtils.TryGetValueAsInt(xmlConfig, "MaxTicksWithoutEating") ?? (_swparams.Height * _swparams.Width + _swparams.TicksBetweenFood);


            _inputMapperName  = XmlUtils.TryGetValueAsString(xmlConfig, "InputMapping") ?? _inputMapperName;
            _outputMapperName = XmlUtils.TryGetValueAsString(xmlConfig, "OutputMapping") ?? _outputMapperName;

            _description     = XmlUtils.TryGetValueAsString(xmlConfig, "Description");
            _parallelOptions = ExperimentUtils.ReadParallelOptions(xmlConfig);

            _eaParams                         = new NeatEvolutionAlgorithmParameters();
            _eaParams.SpecieCount             = _specieCount;
            _neatGenomeParams                 = new NeatGenomeParameters();
            _neatGenomeParams.FeedforwardOnly = _activationScheme.AcyclicNetwork;

            //string nameoftype = (string ) typeof(GridInputMapper).GetProperty("Name", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null, null);

            Type inputType = Assembly.GetAssembly(typeof(IInputMapper)).GetTypes().Where(myType => myType.IsClass && !myType.IsAbstract && (typeof(IInputMapper).IsAssignableFrom(myType)) &&
                                                                                         _inputMapperName == (string)myType.GetProperty("Name", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null, null)).First();

            _inputMapper = (IInputMapper)Activator.CreateInstance(inputType, _swparams);

            Type outputType = Assembly.GetAssembly(typeof(IOutputMapper)).GetTypes().Where(myType => myType.IsClass && !myType.IsAbstract && (typeof(IOutputMapper).IsAssignableFrom(myType)) &&
                                                                                           _outputMapperName == (string)myType.GetProperty("Name", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy).GetValue(null, null)).First();

            _outputMapper = (IOutputMapper)Activator.CreateInstance(outputType);

            //foreach (Type type in
            //Assembly.GetAssembly(typeof(IInputMapper)).GetTypes().Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(IInputMapper) )))
            //{
            //    SnakeRunnerFactory srf = (SnakeRunnerFactory) Activator.CreateInstance(type, swOriginal);
            //    if (srf.Name == _ioLayers)
            //    {
            //        _srf = srf;
            //        break;
            //    }
            //}
        }
コード例 #7
0
ファイル: Genesis.cs プロジェクト: XaaK/GenesisEngine
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;

            IsMouseVisible = true;

            _mainPresenter = ObjectFactory.GetInstance <MainPresenter>();
            _mainPresenter.Show();

            _inputState  = ObjectFactory.GetInstance <IInputState>();
            _inputMapper = ObjectFactory.GetInstance <IInputMapper>();

            SetInputBindings();

            base.Initialize();
        }
コード例 #8
0
 public ParcelServiceMutation(IUnitOfWork unitOfWork, IInputMapper inputMapper, IVendorService vendorService) : base(unitOfWork, inputMapper)
 {
     this.vendorService = vendorService;
 }
コード例 #9
0
 public BillMutation(IUnitOfWork unitOfWork, IUserProvider userProvider, IInputMapper inputMapper,
                     IBillService billService) : base(unitOfWork, inputMapper)
 {
     this.userProvider = userProvider;
     this.billService  = billService;
 }
コード例 #10
0
 public EntityMutationBase(IUnitOfWork unitOfWork, IInputMapper inputMapper)
 {
     this.UnitOfWork  = unitOfWork;
     this.InputMapper = inputMapper;
 }
コード例 #11
0
 public VendorMutation(IUnitOfWork unitOfWork, IInputMapper inputMapper, ILogger <VendorMutation> logger) : base(
         unitOfWork, inputMapper)
 {
     this.logger = logger;
 }
コード例 #12
0
ファイル: InputManager.cs プロジェクト: abeyerdev/FGLib
 public InputManager()
 {
     buffer = new InputBuffer();
     mapper = InputMapperFactory.CreateInputMapper <T>();
 }
コード例 #13
0
 public CustomerMutation(IUnitOfWork unitOfWork, IInputMapper inputMapper) : base(unitOfWork, inputMapper)
 {
 }
コード例 #14
0
 public void BindController(IInputMapper inputConfiguration)
 {
     inputConfiguration.GetDigitalButton("Left").MapTo(gt => this.shipVelocity = shipVelocity.Translate(gt.ElapsedSeconds * -250, 0));
     inputConfiguration.GetDigitalButton("Right").MapTo(gt => this.shipVelocity = shipVelocity.Translate(gt.ElapsedSeconds * 250, 0));
     inputConfiguration.GetDigitalButton("Up").MapTo(gt => this.shipVelocity = shipVelocity.Translate(0, gt.ElapsedSeconds * -150));
     inputConfiguration.GetDigitalButton("Down").MapTo(gt => this.shipVelocity = shipVelocity.Translate(0, gt.ElapsedSeconds * 150));
     inputConfiguration.GetDigitalButton("Fire Weapon").MapTo(this.FireWeapon);
 }
コード例 #15
0
 public UnityInputController(IInputMapper <KeyCode> controller)
 {
     _inputMapper = controller;
 }