summaryrefslogtreecommitdiff
path: root/Entelect.BattleCity.Challenge/AiAgent.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Entelect.BattleCity.Challenge/AiAgent.cs')
-rw-r--r--Entelect.BattleCity.Challenge/AiAgent.cs7
1 files changed, 2 insertions, 5 deletions
diff --git a/Entelect.BattleCity.Challenge/AiAgent.cs b/Entelect.BattleCity.Challenge/AiAgent.cs
index b5118be..06e6fcc 100644
--- a/Entelect.BattleCity.Challenge/AiAgent.cs
+++ b/Entelect.BattleCity.Challenge/AiAgent.cs
@@ -53,22 +53,19 @@ namespace Entelect.BattleCity.Challenge
var stuckLastTurn = checkStuckLastTurn(tank);
var enemyBase = enemy.@base;
-
- var pastMidpoint = (Math.Abs(enemyBase.y-tank.y) < board[0].Length / 2);
+
+ var pastMidpoint = (Math.Abs(enemyBase.y-tank.y) < (board[0].Length / 2));
if (stuckLastTurn && (tank.direction == ChallengeService.direction.UP || tank.direction == ChallengeService.direction.DOWN))
{
_targetX = tank.x + (pastMidpoint!=(tank.x > enemyBase.x) ? +1 : -1);
}
-
-
ChallengeService.direction chosenDirection =
tank.y != enemyBase.y ?
(
_targetX.HasValue && _targetX != tank.x ?
(
-
tank.x > _targetX ?
ChallengeService.direction.LEFT :
ChallengeService.direction.RIGHT