public GameBoard() { EnemyMapper = new EnemyMapper(); EnemyRepository = new EnemyRepository(EnemyMapper); PopulationMapper = new PopulationMapper(); PopulationRepository = new PopulationRepository(); }
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); }
private void CheckIfCurrentPopulationWon() { if (Player.AiCounter == 200 && !Player.Lost) { StopGame = true; PopulationRepository.SaveTrainedPopulation(Player.AiCounter, CurrentPopulation.IdObject, ScoreSprite.score); } }
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); }
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(); }
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); }
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); }
public GameGeneticAlgorithm(PopulationRepository rep, PopulationMapper popMappper, GameSettings settings) { Repository = rep; PopulationMapper = popMappper; Settings = settings; }
public BusinessLogicHouse(IHouseRepos _house) { mapper = new CustomAutoMapper(); house = _house; PopulationRepository = new PopulationRepository(new UoWHouse(new DatabaseContext())); }
public void GenerateStartPopulation() { LabelAfterGeneration = PopulationRepository.GenerateStartPopulation(MapPlayersToPopulation( new PopulationGenerator(settings).GeneratedPopulation)); }
public UnitOfWork(TestAPIContext context) { _context = context; HouseHold = new HouseHoldsRepository(_context); Population = new PopulationRepository(_context); }