public void SwapIfImbalance() { int blueTeamSizeAdvantage = _observation.GetBlueTeamSizeAdvantage(); if (Math.Abs(blueTeamSizeAdvantage) >= 2) { Console.WriteLine("Evening teams"); _manipulation.SwapToBalance(); } }
public void PerformAutoBalance() { _blueTeamSizeAdvantage = _observation.GetBlueTeamSizeAdvantage(); if (_autobalance) { if (_observation.GetTeamsAreBalanced()) { EndAutoBalance(); } else { //Wait for death if (DateTime.Now.Subtract(_autobalanceStartTime).TotalSeconds < 15) { List <int> slots; List <int> empties; if (_blueTeamSizeAdvantage > 0) { slots = _cg.BlueSlots; empties = _observation.EmptyRedSlots(); } else { slots = _cg.RedSlots; empties = _observation.EmptyBlueSlots(); } List <int> dead = _cg.PlayerInfo.GetDeadSlots(); foreach (int deadSlot in dead) { if (slots.Contains(deadSlot)) { if (empties.Count > 0) { int lastEmpty = empties[empties.Count - 1]; _cg.Interact.Move(deadSlot, lastEmpty); } } } } else { //Swap anyone _manipulation.SwapToBalance(); } } } }