コード例 #1
0
 public GameBoard()
 {
     EnemyMapper          = new EnemyMapper();
     EnemyRepository      = new EnemyRepository(EnemyMapper);
     PopulationMapper     = new PopulationMapper();
     PopulationRepository = new PopulationRepository();
 }
コード例 #2
0
 private void SetDefaultValues()
 {
     Player            = new Player(new Vector2(300, 600), new Vector2(19, 19), "2D\\Player");
     ScoreSprite       = new ScoreSprite(Player, PopulationRepository.MaxPopGenerationNumber);
     Population        = PopulationMapper.MapEntirePopDbToPop(PopulationRepository.GetPopulationFromDb());
     Enemies           = EnemyRepository.GetEnemiesFromDb();
     CurrentPopulation = Population.First(x => x.AfterGame == false);
 }
コード例 #3
0
 private void CheckIfCurrentPopulationWon()
 {
     if (Player.AiCounter == 200 && !Player.Lost)
     {
         StopGame = true;
         PopulationRepository.SaveTrainedPopulation(Player.AiCounter, CurrentPopulation.IdObject, ScoreSprite.score);
     }
 }
コード例 #4
0
        private void SaveResultForCurrentPopulationAfterLost()
        {
            var popAfterGame = Population.First(x => !CurrentPopulation.AfterGame && x.IdObject == CurrentPopulation.IdObject && x.AfterGame == false);

            popAfterGame.AfterGame  = true;
            popAfterGame.MovesCount = Player.AiCounter;

            PopulationRepository.UpdateScoreForCurrentPopulation(Player.AiCounter, CurrentPopulation.IdObject, ScoreSprite.score);
        }
コード例 #5
0
 public ConfigurationViewModel(GameSettings gameSetting) : base()
 {
     PopulationRepository    = new PopulationRepository();
     Configurationrepository = new ParametersRepository();
     settings          = gameSetting;
     SpeedOfGame       = gameSetting.SzybkoscGry.ToString();
     AmounOfPopulation = gameSetting.AmountOfPopulation.ToString();
     MutationPercent   = gameSetting.MuationPercent.ToString();
 }
コード例 #6
0
        private void SetDefaultTest()
        {
            Player      = new Player(new Vector2(300, 600), new Vector2(19, 19), "2D\\Player");
            ScoreSprite = new ScoreSprite(Player, 0);
            Population  = PopulationMapper.MapEntirePopDbToPop(PopulationRepository.GetPopulationFromDb());
            Enemies     = EnemyRepository.GetEnemiesFromDb();
            var best = PopulationRepository.GetBestPopulation();

            CurrentPopulation = PopulationMapper.MapPopDbToPop(best, best.IdObject);
        }
コード例 #7
0
        public bool CanGenerate()
        {
            bool result = true;

            if (settings.AmountOfPopulation == null || settings.AmountOfPopulation == 0)
            {
                LabelAfterGeneration = "Wielkośc populacji nie może być równa 0 ";
                return(false);
            }
            if (!PopulationRepository.CanGenerateStartingPopulation())
            {
                LabelAfterGeneration = "Populacja jest już wygenerowana";
                return(false);
            }
            return(result);
        }
コード例 #8
0
 public GameGeneticAlgorithm(PopulationRepository rep, PopulationMapper popMappper, GameSettings settings)
 {
     Repository       = rep;
     PopulationMapper = popMappper;
     Settings         = settings;
 }
コード例 #9
0
 public BusinessLogicHouse(IHouseRepos _house)
 {
     mapper = new CustomAutoMapper();
     house  = _house;
     PopulationRepository = new PopulationRepository(new UoWHouse(new DatabaseContext()));
 }
コード例 #10
0
 public void GenerateStartPopulation()
 {
     LabelAfterGeneration = PopulationRepository.GenerateStartPopulation(MapPlayersToPopulation(
                                                                             new PopulationGenerator(settings).GeneratedPopulation));
 }
コード例 #11
0
 public UnitOfWork(TestAPIContext context)
 {
     _context = context;
     HouseHold = new HouseHoldsRepository(_context);
     Population = new PopulationRepository(_context);
 }