/// <summary> /// Plays one game and returns the score of this AI /// </summary> public double CalculateScore() { if (this.enemy == null) { throw new Exception("Enemy not set. Call SetEnemy first"); } var aiPlayer = new AIPlayer(); var enemyAIPlayer = new AIPlayer(); var simulatedGame = new SimulatedGame(enemyAIPlayer, aiPlayer, winMultiplier, abortMultiplier, killMultiplier, aliveMultiplier, flyMultiplier, moveMultiplier, loseMultiplier, falseKillMultiplier, falseMoveMultiplier, falseFlightMultiplier, falsePlacementMultiplier, maxMoves); OverrideEmptyAIPlayer(aiPlayer, simulatedGame); enemy.OverrideEmptyAIPlayer(enemyAIPlayer, simulatedGame); SpeciesInfo info; var rVal = simulatedGame.Simulate(out info); this.CachedSpeciesInfo = info; info.AI = this; return(CachedScore = rVal); }
public void SetInfo(SpeciesInfo info) { this.currentInfo = info; Button_Play.IsEnabled = true; Label_Win.Content = info.Aborted ? "Aborted" : info.Win ? "Yes" : "No"; Label_Alive.Content = info.MenAlive; Label_Kills.Content = $"{info.MenKilled} / {info.InvalidKills}"; Label_Moves.Content = $"{info.Moves} / {info.InvalidMoves}"; Label_Flights.Content = $"{info.Flights} / {info.InvalidFlights}"; Label_InvalidPlacements.Content = info.InvalidPlacements; }