private void TakeActionOnEachBot(ActiveTurnData turnData) { if (BattleActive) { // TODO: CHECK INACTIVE and DEAD BOTS DONT GET TURNS (unit test) // TODO : UNIT TEST, bot that thorws exception is killed EachActiveBot((mappedBot) => { LastTickRecord ltr; if (turnData.LastTickRecords.ContainsKey(mappedBot.EngineId)) { ltr = turnData.LastTickRecords[mappedBot.EngineId]; turnData.LastTickRecords.Remove(mappedBot.EngineId); } else { ltr = new LastTickRecord(); } try { mappedBot.Bot.TakeAction(Turn, Tick, ltr); } catch (Exception ex) { b.Info.Dump(ex, "Exception in BOT" + mappedBot.Bot.Name); PerformBotDeath(mappedBot, BotEndReason.ExceptionOccured); } }); } }
public void TakeAction(int turn, int tick, LastTickRecord ltr) { this.WhatHappened = ltr; if (turn != LastTurnReceived) { BotTurnStartAction(turn); LastTurnReceived = turn; } BotTakeAction(turn, tick, ltr); }
private void CreateNextTurnNotificationMessage(int p, bd2TickAction action) { LastTickRecord ltr; if (activeData.LastTickRecords.ContainsKey(p)) { ltr = activeData.LastTickRecords[p]; } else { ltr = new LastTickRecord(); activeData.LastTickRecords.Add(p, ltr); } ltr.Events.Push(action); }
protected abstract void BotTakeAction(int turn, int tick, LastTickRecord ltr);