///<summary> /// Sets new position after kickout ///</summary> ///<returns>Returns new Drone position</returns> public Position GetPositionAfterKickout() { var kickOutPositions = new List <Position>(); for (int x = 0; x < AntColony.GetWidth(); x++) { kickOutPositions.Add(new Position(x, 0)); kickOutPositions.Add(new Position(x, AntColony.GetWidth() - 1)); kickOutPositions.Add(new Position(0, x)); kickOutPositions.Add(new Position(AntColony.GetWidth() - 1, x)); } return(kickOutPositions[new Random().Next(kickOutPositions.Count)]); }
/// <summary> /// Checks validity of Worker move /// </summary> /// <param name="next"> next </param> /// <returns> /// Returns bool /// </returns> public bool IsMoveValid(Position next) { if (next.X >= AntColony.GetWidth() || next.X < 0) { return(false); } else if (next.Y >= AntColony.GetWidth() || next.Y < 0) { return(false); } else { return(true); } }