diff options
author | Justin Worthe <justin.worthe@entelect.co.za> | 2013-11-03 18:44:13 +0200 |
---|---|---|
committer | Justin Worthe <justin.worthe@entelect.co.za> | 2013-11-03 18:44:13 +0200 |
commit | caed4974a949c43b7dbcc8dbc545189aab710919 (patch) | |
tree | 092b08fb05cf9bfb87f88dc9116cb027026c5fa5 /Entelect.BattleCity.Challenge/AiAgent.cs | |
parent | e7d34b5c57540efc1411be3fdeb9477373f12c9e (diff) |
Updated timing to use relative time rather than absolute time for sleeping
Diffstat (limited to 'Entelect.BattleCity.Challenge/AiAgent.cs')
-rw-r--r-- | Entelect.BattleCity.Challenge/AiAgent.cs | 7 |
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 |