/// <summary> /// Initialize this bot. /// </summary> public void Initialize() { me = game.Players[game.GameOptions.PlayerId]; pathfinder = new Pathfinder(game.Board); areafinder = new AreaFinder(game.Board); round = 0; }
public Simple(int windowSize=2, AreaFinder areaFinder = null) { _areaFinder = areaFinder ?? new AreaFinders.Exhaustive(); var open = new Morphology.WindowFuncs.And(windowSize); var close = new Morphology.WindowFuncs.Or(windowSize); _filters = new Morphology.Filters<bool>(open, close); }
protected virtual void FindNextTarget() { Target = AreaFinder.GetClosestTargetInSight(transform.position); if (Target != null) { PredictedTargetLocation = GetPredictedPosition(transform.position, ProjectileSpeed, Target); } }
protected override void LaunchAttack() { List <Character> targetCharacters = AreaFinder.GetCharacters(); foreach (Character character in targetCharacters) { character.Damage(DamagePerAttack); } }
static void Main(string[] args) { #region circle Console.WriteLine("Введите раудиус круга:"); double r = Convert.ToDouble(Console.ReadLine()); (double s, string figure) = AreaFinder.GetCircleArea(r); Console.WriteLine($"Площадь = {s}; Фигура: {figure}"); #endregion #region triangle Console.WriteLine("\nВведите стороны треугольника:"); Console.WriteLine("Введите a:"); double a = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Введите c:"); double c = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("Введите b:"); double b = Convert.ToDouble(Console.ReadLine()); (s, figure) = AreaFinder.GetTriangleArea(a, c, b); Console.WriteLine($"Площадь = {s}; Фигура: {figure}"); #endregion #region unknown Console.WriteLine("\nВведите количество параметров:"); int count = Convert.ToInt32(Console.ReadLine()); double [] figureParams = new double[count]; Console.WriteLine("Введите параметры по 1:"); for (int i = 0; i < count; i++) { Console.Write(i + ")"); figureParams[i] = Convert.ToDouble(Console.ReadLine()); } (s, figure) = AreaFinder.GetUnknownFigureArea(figureParams); Console.WriteLine($"Площадь = {s}; Фигура: {figure}"); #endregion Console.ReadKey(); }
/** * Loads the map definition from the linked file. */ private void LoadMapFromFile() { // Load text file from TextAsset. string map_string = mapFile.text; string[] lines = map_string.Split('\n'); // Parse map size. int lidx = 0; // Parsing line index string current = ""; while (current != "map") { current = lines[lidx]; string[] par = current.Split(' '); // Map Parameters, Ignore "type". switch (par[0]) { case "height": rsize = int.Parse(par[1]); break; case "width": csize = int.Parse(par[1]); break; default: break; } lidx++; } if (rsize == 0 || csize == 0) { throw new Exception("Invalid Map File!"); } // Initialize map array staticMap = new char[rsize * csize]; // Fill the map int i = 0; for (int line = lidx; line < lines.Length; line++) { string map_items = lines[line]; for (int j = 0; j < map_items.Length; j++) { staticMap[i] = map_items[j]; i++; } } if (i < rsize * csize - 1) { throw new Exception("Invalid Map File!"); } // Find Areas AreaFinder af = new AreaFinder(staticMap, rsize, csize, this); this.areasMap = af.FindAreas(); this.doors = af.FindAreaDoors(areasMap); ///* TMP */ //string res = ""; //for (int x=0;x<rsize;x++) { // for (int y=0;y<csize;y++) { // res += areasMap [x * csize + y] + " "; // } // res += "\n"; //} //Debug.Log(res); ///* END */ }
void Start() { AreaFinder = GetComponent <AreaFinder>(); AreaFinder.TargetTag = TargetTag; }
/** * Loads the map definition from the linked file. */ private void LoadMapFromFile() { // Load text file from TextAsset. string map_string = mapFile.text; string[] lines = map_string.Split('\n'); // Parse map size. int lidx = 0; // Parsing line index string current = ""; while (current != "map") { current = lines[lidx]; string[] par = current.Split(' '); // Map Parameters, Ignore "type". switch (par[0]) { case "height" : rsize = int.Parse(par[1]); break; case "width" : csize = int.Parse(par[1]); break; default : break; } lidx++; } if (rsize == 0 || csize == 0) { throw new Exception("Invalid Map File!"); } // Initialize map array staticMap = new char[rsize*csize]; // Fill the map int i = 0; for (int line=lidx;line<lines.Length;line++) { string map_items = lines[line]; for (int j=0;j<map_items.Length;j++) { staticMap[i] = map_items[j]; i++; } } if (i < rsize * csize - 1) throw new Exception("Invalid Map File!"); // Find Areas AreaFinder af = new AreaFinder(staticMap,rsize,csize, this); this.areasMap = af.FindAreas(); this.doors = af.FindAreaDoors(areasMap); ///* TMP */ //string res = ""; //for (int x=0;x<rsize;x++) { // for (int y=0;y<csize;y++) { // res += areasMap [x * csize + y] + " "; // } // res += "\n"; //} //Debug.Log(res); ///* END */ }
private void Start() { TryGetComponent(out Tower tower); AreaFinder = tower.AreaFinder; }