public override void DeploySoldiers() { //GetOwnSoldiers(); //This is the basis of my strategy evaluation //If the score is rising, the strategy works and Soldiers score //If not, I switch to my backup strategy //Evaluation starts after 100 turns because I have to create towers myself //Every 14 turns, check for progress in the score department if (TurnCounter.turnCounter % 14 == 0) { if (EvaluateScore.efficientOne) { EvaluateScore.efficientOne = EvaluateScore.Scoring(player); } else { EvaluateScore.efficientTwo = EvaluateScore.Scoring(player); } } //Every 10 turns set the current score as previous score if (TurnCounter.turnCounter % 10 == 0) { //Console.WriteLine(EvaluateScore.previousScore); EvaluateScore.previousScore = player.Score; } //---Strategy A--- Strategy versus non-wall using enemies //If there are no towers on the map, or my soldier score and no walls detected //Spawn waves of soldiers every 14 gold hurtMap.GenerateHurtMap(); if (!hurtMap.DetectWalls(hurtMap.enemyTowerPositions) && !EvaluateScore.backUpStrategy) { if (hurtMap.ReturnWholeHurtMapValue(hurtMap.enemyTowerHurtMap) == 0 || EvaluateScore.efficientOne || EvaluateScore.efficientTwo) { if (player.Gold > 14) { for (int i = 0; i < PlayerLane.WIDTH; i++) { Soldier soldier = this.player.BuySoldier(attackLane, i); } } } } //---Strategy B--- Strategy against enemies that use a (double) wall to pool money and spam soldiers at turn >900 //If my first strategy is not succesful and my score does not increase //Pool money until turn 750, then use that money to diminish all the saved money of the enemy, destroy his base and win the game else { EvaluateScore.backUpStrategy = true; if (TurnCounter.turnCounter > 750) { for (int i = 0; i < PlayerLane.WIDTH; i++) { Soldier soldier = this.player.BuySoldier(attackLane, i); } } } }
//Check if the enemy has tower on his defendlane private bool DoesEnemyHaveTowers(TowerHurtMap hurtMap) { int hurt = hurtMap.ReturnWholeHurtMapValue(hurtMap.enemyTowerHurtMap); if (hurt == 0) { return(true); } return(false); }