public Game() { GameBuilder builder = new GameBuilder(); Cg = builder.CustomGameBuilder(); Phases = builder.PhaseManagerBuilder(); _loop = builder.LoopBuilder(Phases); Chat = builder.ChatBuilder(Cg.Chat); //ISlotContentHistory slotContentHistory = builder.SlotContentHistoryBuilder(); BotsModifiedFlag modifiedFlag = new BotsModifiedFlag(); Slots = builder.SlotBuilder(Cg.AI, FilledSlotsFunc, modifiedFlag); Bots = builder.BotBuilder(Cg.AI, Slots, modifiedFlag); //Players = new PlayerManager(this); //Match = new MatchManager(this); //Logger = new MatchLogger(this); //Maps = new MapChooser(this, Map.A_HorizonLunarColony); //todolater get this from the user. Also need to load preset //Joins = new JoinManager(this); //Loop.AddPhaselessLoop(IncrementTime, 1); }
public void TestWhenBotsModifiedThenUpdatesBotLocations() { BotsModifiedFlag flag = new BotsModifiedFlag(); flag.Flag(); FakeBotDeltinObservation botDeltinObservation = new FakeBotDeltinObservation(); FakeDeltinObservations observation = new FakeDeltinObservations(botDeltinObservation); Dictionary<int, List<SlotContent> > fakeHistory = new Dictionary<int, List<SlotContent>>() { {0, new List<SlotContent>(){ SlotContent.Player} }, {2, new List<SlotContent>(){SlotContent.Player} }, {4, new List<SlotContent>(){SlotContent.Player} }, {6, new List<SlotContent>(){ SlotContent.Player} }, {8, new List<SlotContent>(){SlotContent.Player} }, {10, new List<SlotContent>(){SlotContent.Player} }, { 1, new List<SlotContent>(){SlotContent.Bot} }, {3, new List<SlotContent>(){SlotContent.Bot} }, {7, new List<SlotContent>(){SlotContent.Bot} }, {9, new List<SlotContent>(){SlotContent.Bot} }, {5, new List<SlotContent>(){SlotContent.Empty} }, {11,new List<SlotContent>(){ SlotContent.Empty} }, }; SlotContentObserver sut = new SlotContentObserver(flag, observation); List<SlotContent> result = sut.Observe(fakeHistory); Assert.IsTrue(result[0] == SlotContent.Bot); Assert.IsTrue(result[1] == SlotContent.Player); Assert.IsTrue(result[2] == SlotContent.Bot); Assert.IsTrue(result[3] == SlotContent.Player); Assert.IsTrue(result[4] == SlotContent.Bot); Assert.IsTrue(result[6] == SlotContent.Bot); Assert.IsTrue(result[7] == SlotContent.Player); Assert.IsTrue(result[8] == SlotContent.Bot); Assert.IsTrue(result[9] == SlotContent.Player); Assert.IsTrue(result[10] == SlotContent.Bot); }
public IBotManager BotBuilder(Deltin.CustomGameAutomation.AI ai, ISlotManager slots, BotsModifiedFlag modifiedFlag) { BotRequests requests = new BotRequests(); IBotRequester requester = new BotRequester(requests); IBotExpectations expectations = new BotExpectations(requests, slots); IBotDeltinManipulator deltinManipulator = new BotDeltinManipulator(ai); IBotManipulation manipulation = new BotManipulation(slots, deltinManipulator, modifiedFlag); IBotCorruption corruption = new BotCorruption(slots.Bots, expectations); IBotRequestFulfillmentManager botRequestFulfillmentManager = new BotRequestFulfillmentManager(expectations, manipulation, corruption); IBotManager bots = new BotManager(requester, botRequestFulfillmentManager); return(bots); }
public ISlotManager SlotBuilder(Deltin.CustomGameAutomation.AI ai, Func <List <int> > filledSlotsFunction, BotsModifiedFlag modifiedFlag) { BotDeltinObservation botDeltinObservation = new BotDeltinObservation(ai); DeltinSlotObservation deltinSlotObservation = new DeltinSlotObservation(botDeltinObservation, filledSlotsFunction); ISlotContentObserver observer = new SlotContentObserver(modifiedFlag, deltinSlotObservation); ISlotContentHistory history = new SlotContentHistory(observer); ISlotManager slots = new SlotManager(history); return(slots); }
internal SlotContentObserver(BotsModifiedFlag modifiedFlag, IDeltinSlotObservation observation) { _modifiedFlag = modifiedFlag; _observation = observation; }