/// <summary> /// Clicks at a set of coordinates using the primary mouse button. /// </summary> /// <param name="where">An <see cref="ICoordinates"/> describing where to click.</param> public void Click(ICoordinates where) { this.MoveIfNeeded(where); Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("button", 0); this.driver.InternalExecute(DriverCommand.MouseClick, parameters); }
/// <summary> /// Function extracting a rectangular section of the map /// </summary> /// <param name="centerPoint">The point on which the section shall be centered</param> /// <param name="subWidth">The odd numbered width of the section</param> /// <param name="subHeight">The odd numbered height of the section</param> /// <returns>A 2D list MapTiles</returns> public MapTile[,] GetSubset(ICoordinates centerPoint, short subWidth, short subHeight) { // Check input parameters if (null == centerPoint || 0 == subWidth % 2 || 0 == subHeight % 2 || subWidth < MinimumMapSize || subHeight < MinimumMapSize || subHeight > Height || subWidth > Width) return null; // Get the number of rows / columns that there are on the side of the cell on the extract var numberOfSideColumns = (short)Math.Truncate((float)(subWidth / 2)); var numberOfSideRows = (short) Math.Truncate((float) (subHeight/2)); // Get the top left coordinates of the extract var smallGridMinX = centerPoint.X - numberOfSideColumns > 0 ? Convert.ToInt16(centerPoint.X - numberOfSideColumns) : (Int16)0; var smallGridMinY = centerPoint.Y - numberOfSideRows > 0 ? Convert.ToInt16(centerPoint.Y - numberOfSideRows) : (Int16)0; // Get the bottom right coordinates of the extract (-1 since we are working with a 0 based array) var smallGridMaxX = smallGridMinX + subWidth >= Grid.GetLength(0) ? Convert.ToInt16(Grid.GetLength(0) - 1) : Convert.ToInt16(smallGridMinX + subWidth -1); var smallGridMaxY = smallGridMinY + subHeight >= Grid.GetLength(1) ? Convert.ToInt16(Grid.GetLength(1) - 1) : Convert.ToInt16(smallGridMinY + subHeight -1); MapTile[,] subArray = GetSubArray(smallGridMinX, smallGridMaxX, smallGridMinY, smallGridMaxY); if (subArray == null) { } return subArray; }
/// <summary> Рандомный шаг из данных координат /// </summary> /// <param name="xy"></param> /// <returns></returns> //----------------------------------------------- internal static IStep randomVectorStep(ICoordinates xy) { Random r = new Random (); ICoordinates t=xy; bool found=false; int i =-1; while (!found) { i = r.Next ( 3 ); switch (i) { case 0: { t = StepsAndCoord.Coordinates ( xy.getX () + 1,xy.getY () + 0 ); } break; case 1: { t = StepsAndCoord.Coordinates ( xy.getX () - 1,xy.getY () + 0 ); } break; case 2: { t = StepsAndCoord.Coordinates ( xy.getX () + 0,xy.getY () + 1 ); } break; case 3: { t = StepsAndCoord.Coordinates ( xy.getX () + 0,xy.getY () - 1 ); } break; } if (EpsilonBot.api.isNorm ( t )) { found = EpsilonBot.api.getTypeOfField ( t ) != TypesOfField.WALL; } } return StepsAndCoord.StepsBuilder ( t,Steps.STEP ); }
internal static IStep randomVectorStep(ICoordinates xy) { Random r = new Random (); ICoordinates t=xy; bool found=false; int i =-1; while (!found) { i = r.Next ( 3 ); switch (i) { case 0: { t = Helper.Coordinates ( xy.getX () + 1,xy.getY () + 0 ); found = EpsilonBot.api.isNorm ( t ); } break; case 1: { t = Helper.Coordinates ( xy.getX () - 1,xy.getY () + 0 ); found = EpsilonBot.api.isNorm ( t ); } break; case 2: { t = Helper.Coordinates ( xy.getX () + 0,xy.getY () + 1 ); found = EpsilonBot.api.isNorm ( t ); } break; case 3: { t = Helper.Coordinates ( xy.getX () + 0,xy.getY () - 1 ); found = EpsilonBot.api.isNorm ( t ); } break; } } return Helper.StepsBuilder ( t,Steps.STEP ); }
/// <summary> /// Adds the color at the given coordinates to be painted during the next loop /// </summary> /// <param name="elementCoordinates"></param> /// <param name="qualifier"></param> public void SetDynamicElement(ICoordinates elementCoordinates, DisplayQualifier qualifier) { if (!this.UpdatedElements.ContainsKey(elementCoordinates)) this.UpdatedElements.Add(elementCoordinates, this.colorPanel.GetCorrespondingColor(qualifier)); else if (this.UpdatedElements[elementCoordinates] == this.BackgroundGrid[elementCoordinates.X, elementCoordinates.Y].GetColor()) this.UpdatedElements[elementCoordinates] = this.colorPanel.GetCorrespondingColor(qualifier); }
/// <summary>/// Перегрузка конструктора CStep /// </summary> internal static IStep StepsBuilder(ICoordinates coord,Steps step) { IStep s = new CStep (); s.setCoord ( coord ); s.setTypeOfStep (step); return s; }
/// <summary> /// Constructor /// </summary> public OffsetVector(ICoordinates coordinatesFrom, ICoordinates coordinatesTo) { //this.X = Convert.ToInt16(coordinatesFrom.X - coordinatesTo.X); //this.Y = Convert.ToInt16(coordinatesFrom.Y - coordinatesTo.Y); this.X = Convert.ToInt16(coordinatesTo.X - coordinatesFrom.X); this.Y = Convert.ToInt16(coordinatesTo.Y - coordinatesFrom.Y); }
/// <summary> /// /// </summary> /// <param name="position"></param> /// <param name="coordinates"></param> /// <returns></returns> public Int16? DistanceTo(ICoordinates position) { if (position == null) return null; return (Int16)(Math.Abs((UInt16)(this.X - position.X)) + Math.Abs((UInt16)(this.Y - position.Y))); }
/// <summary>конструктор /// </summary> /// <param name="needElement">тип ячейки к которой необходимо проложить маршрут</param> /// <param name="startPoint">отправная точка</param> /// <param name="stepCount">максимальная удаленность объекта</param> /// <returns></returns> internal Logistics(ICoordinates xy,int gunTimer,int roadLen,Logistics back) { this.len = roadLen; this.m_gunTimer = gunTimer; this.m_xy = xy; this.m_back = back; this.mind = mind; }
public string GetClosestTrendLocationsQuery(ICoordinates coordinates) { var query = new StringBuilder(Resources.Trends_GetClosestTrendsLocations); query.AddParameterToQuery("lat", coordinates.Latitude); query.AddParameterToQuery("long", coordinates.Longitude); return query.ToString(); }
// Builder internal Person(string name,ICoordinates xy) { m_name = name; Health = HealthLast = EpsilonBot.api.myHealth ();// cHealthMax; Money = MoneyLast = 0; m_gun = new Gun (); m_XY = xy; m_wasFound = false; }
internal CGameBot(masterСhief eye, int health, int points, ICoordinates pos) { Eyes = eye; Health = health; Points = points; TurnsToShoot = 0; Position = pos; TurnsToStep = 0; }
internal MapSector(ICoordinates mom,ICoordinates I,int roadlength) { i = 0; this.mom = new ICoordinates[3]; this[i]= mom; this.xy = I; roadLength = roadlength; type = TypesOfField.WALL; }
//--------------------------- //Build internal Mind(int stepLimit,ICoordinates xy) { i = new Person ( "Epsilon",xy ); ICoordinates unknown = Helper.Coordinates ( unknownCoord,unknownCoord ); he = new Person ( "Frag",unknown ); healthXY = new LinkedList<MapSector> (); moneyXY = new LinkedList<MapSector> (); hisMayBeXY = new LinkedList<MapSector> (); this.m_stepLimit = stepLimit; }
public string GenerateGeoParameter(ICoordinates coordinates) { if (coordinates == null) { return null; } string latitudeValue = coordinates.Latitude.ToString(CultureInfo.InvariantCulture); string longitudeValue = coordinates.Longitude.ToString(CultureInfo.InvariantCulture); return String.Format(Resources.Geo_CoordinatesParameter, longitudeValue, latitudeValue); }
//----------------------------------------------- /// <summary>Конструктор /// </summary> /// <param name="back"></param> /// <param name="money">количество денег на данном маршруте</param> /// <param name="health">количество аптечек на данном маршруте</param> /// <param name="len">длиннна маршрута</param> /// <param name="gunTime">активность оружия противника</param> /// <param name="xy">координаты исходного (данного) сектора</param> internal Ways(ICoordinates back,int money,int health,int len,int gunTime,ICoordinates xy) { m_back = new CCoordinates (); m_back.Copy(back); m_money = money; m_health=health; m_len=len; m_gun = new Gun (); m_gun.TurnOnTimer(gunTime); m_xy = new CCoordinates (); m_xy.Copy(xy); }
public string GenerateGeoParameter(ICoordinates coordinates) { if (coordinates == null) { throw new ArgumentNullException("Coordinates cannot be null."); } string latitudeValue = coordinates.Latitude.ToString(CultureInfo.InvariantCulture); string longitudeValue = coordinates.Longitude.ToString(CultureInfo.InvariantCulture); return string.Format(Resources.Geo_CoordinatesParameter, longitudeValue, latitudeValue); }
/// <summary> /// Moves the mouse to the specified set of coordinates. /// </summary> /// <param name="where">A <see cref="ICoordinates"/> describing where to move the mouse to.</param> public void MouseMove(ICoordinates where) { if (where == null) { throw new ArgumentNullException("where", "where coordinates cannot be null"); } string elementId = where.AuxiliaryLocator.ToString(); Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("element", elementId); this.driver.InternalExecute(DriverCommand.MouseMoveTo, parameters); }
public ILocation GenerateLocation(ICoordinates coordinates1, ICoordinates coordinates2) { if (coordinates1 == null || coordinates2 == null) { return null; } var coordinates1Parameter = _locationUnityFactory.GenerateParameterOverrideWrapper("coordinates1", coordinates1); var coordinates2Parameter = _locationUnityFactory.GenerateParameterOverrideWrapper("coordinates2", coordinates2); return _locationUnityFactory.Create(coordinates1Parameter, coordinates2Parameter); }
/// <summary> /// Constructor /// </summary> /// <param name="coordinates"></param> public SurroundingView(ICoordinates coordinates, MapTile[,] view) { // Set the center coordinate CellPositionInWorld = coordinates; viewSizeX = Convert.ToInt16(view.GetUpperBound(0)); viewSizeY = Convert.ToInt16(view.GetUpperBound(1)); CellPositionInView = new Coordinates((Int16)(viewSizeX / 2), (Int16)(viewSizeY / 2)); View = new Map(viewSizeX, viewSizeY); View.InitializeGrid(view); }
public CMap() { maxX = 10; maxY = 10; rand=new Random(); Walls=0; Spaces=AllSize; Bonuses=0; Medics=0; EmptyCoords=new List<ICoordinates>(); Bot1 = new CCoordinates(); Bot2 = new CCoordinates(); }
public static bool CoordinatesLocatedIn(ICoordinates coordinates, ICoordinates boxCoordinates1, ICoordinates boxCoordinates2) { bool xIsBelowCoord1AndAboveCoord2 = boxCoordinates1.Longitude >= coordinates.Longitude && coordinates.Longitude >= boxCoordinates2.Longitude; bool xIsAboveCoord1AndBelowCoord2 = boxCoordinates1.Longitude <= coordinates.Longitude && coordinates.Longitude <= boxCoordinates2.Longitude; bool yIsRightCoord1AndLeftCoord2 = boxCoordinates1.Latitude >= coordinates.Latitude && coordinates.Latitude >= boxCoordinates2.Latitude; bool yIsLeftCoord1AndRightCoord2 = boxCoordinates1.Latitude <= coordinates.Latitude && coordinates.Latitude <= boxCoordinates2.Latitude; return (xIsAboveCoord1AndBelowCoord2 || xIsBelowCoord1AndAboveCoord2) && (yIsLeftCoord1AndRightCoord2 || yIsRightCoord1AndLeftCoord2); }
/// <summary> /// Shoots a balloon at a position passed as a parameter. /// </summary> /// <param name="positionToShoot">The position of the balloon.</param> public void ShootBalloonAtPosition(ICoordinates positionToShoot) { char balloonToShoot = this.GetBaloonTypeFromPosition(positionToShoot); if (balloonToShoot == (char)BallonType.Popped) { throw new ArgumentException(GlobalMessages.AlreadyPoppedBalloonsMsg); } else if (balloonToShoot == (char)BallonType.Invalid) { throw new ArgumentException(GlobalMessages.InvalidCoordinatesExceptionMsg); } this.Game.Field.UpdateField(positionToShoot, '.'); this.Game.RemainingBalloons--; this.ShootSameBalloonsInDirection(ShootingDirection.Up, positionToShoot, balloonToShoot); this.ShootSameBalloonsInDirection(ShootingDirection.Down, positionToShoot, balloonToShoot); this.ShootSameBalloonsInDirection(ShootingDirection.Left, positionToShoot, balloonToShoot); this.ShootSameBalloonsInDirection(ShootingDirection.Right, positionToShoot, balloonToShoot); this.Game.ShootCounter++; this.LandFlyingBaloons(); }
public TweetObj(string text, string creatorName, string screenName, DateTime time, ICoordinates coords, IPlace place, List<IHashtagEntity> hashtags) { this.text = text; if (creatorName == ""){ this.creatorName = " "; } else { this.creatorName = creatorName; } if (screenName == "") { this.screenName = " "; } else { this.screenName = screenName; } this.time = time; if (coords != null) { this.coords = coords; } else { this.coords = new Coordinates(0.0,0.0); } if (place != null) { this.country = place.Country; } else{ country = " "; } this.hashtags = new List<String>(); for (int i= 0; i < hashtags.Count; i++) { this.hashtags.Add(hashtags[i].Text); } }
public bool PublishWithGeoInReplyTo(ICoordinates coordinates, long replyToTweetId) { return(_tweetController.PublishTweetWithGeoInReplyTo(this, coordinates, replyToTweetId)); }
/// <summary> /// Копирование в эту координату другой /// </summary> /// <param name="co">Что копируем</param> public void Copy(ICoordinates co) { this.X = co.X0; this.Y = co.Y0; }
public async Task <bool> PublishWithGeoAsync(ICoordinates coordinates) { return(await _taskFactory.ExecuteTaskAsync(() => PublishWithGeo(coordinates))); }
/// <summary> /// Add a marble /// </summary> /// <param name="color">Color of the new marble</param> /// <param name="coordinates">Coordinates of the new marble</param> public void NewMarble(MarbleColor color, ICoordinates coordinates) { _marbles.Add(new Marble(color, coordinates)); }
public void Change(ICoordinates cordiantes) { Change(cordiantes.CordY, cordiantes.CordX); }
public SearchTweetsParameters(ICoordinates coordinates, int radius, DistanceMeasure measure) : this() { GeoCode = new GeoCode(coordinates, radius, measure); }
public static string FormatCoordinates(ICoordinates coordinates) { return($"------------------------------------{coordinates?.Latitude},{coordinates?.Longitude}"); }
/// <summary> /// Double-clicks at a set of coordinates. /// </summary> /// <param name="where">A <see cref="ICoordinates"/> describing where to double-click.</param> public void DoubleClick(ICoordinates where) { this.driver.InternalExecute(DriverCommand.MouseDoubleClick, null); }
public GeoCode(ICoordinates coordinates, double radius, DistanceMeasure distanceMeasure) { Coordinates = coordinates; Radius = radius; DistanceMeasure = distanceMeasure; }
public bool ContainsLocation(ICoordinates coordinate1, ICoordinates coordinate2) { return(Locations.Keys.Any(x => (x.Coordinate1 == coordinate1 && x.Coordinate2 == coordinate2) || (x.Coordinate1 == coordinate2 && x.Coordinate2 == coordinate1))); }
/// <summary> /// Releases the primary mouse button at a set of coordinates. /// </summary> /// <param name="where">A <see cref="ICoordinates"/> describing where to release the mouse button.</param> public void MouseUp(ICoordinates where) { this.driver.InternalExecute(DriverCommand.MouseUp, null); }
public static Coordinates Sub(ICoordinates right, ICoordinates left) { return(new Coordinates(x: right.X - left.X, y: right.Y - left.Y)); }
private Boolean CoordinatesAreWithinBounds(ICoordinates coord) { return this.CoordinatesAreWithinBounds(coord.X, coord.Y); }
/// <summary> /// /// </summary> /// <param name="targetCoordinates"></param> /// <returns></returns> private bool TargetTileIsOccupied(ICoordinates targetCoordinates) { bool canMove = false; IMap thisMap = this.world.GetMap(); // If the target cell is occupied if ((thisMap.GetCellAt(targetCoordinates.X, targetCoordinates.Y)) != null) canMove = true; return canMove; }
public bool PublishWithGeo(ICoordinates coordinates) { _tweetDTO.Coordinates = coordinates; return(_tweetController.PublishTweet(this)); }
public ITweetSearchParameters CreateSearchTweetParameter(ICoordinates coordinates, int radius, DistanceMeasure measure) { return(new TweetSearchParameters(coordinates, radius, measure)); }
public void SetGeoCode(ICoordinates coordinates, double radius, DistanceMeasure measure) { GeoCode = new GeoCode(coordinates, radius, measure); }
public BoardField(int x, int y) { coordinates = new Coordinates(x, y); }
public static ITweetSearchParameters CreateTweetSearchParameter(ICoordinates coordinates, int radius, DistanceMeasure measure) { return(SearchQueryParameterGenerator.CreateSearchTweetParameter(coordinates, radius, measure)); }
/// <summary> /// Releases the primary mouse button at a set of coordinates. /// </summary> /// <param name="where">A OpenQA.Selenium.Interactions.Internal.ICoordinates describing where to release /// the mouse button.</param> public void MouseUp(ICoordinates where) { // Method intentionally left empty. }
public static double Distance(ICoordinates point1, ICoordinates point2) { return Coordinates.Sub(point2, point1).Module; }
/// <summary> /// Moves the mouse to the specified set of coordinates. /// </summary> /// <param name="where">A OpenQA.Selenium.Interactions.Internal.ICoordinates describing where to click.</param> /// <param name="offsetX">A horizontal offset from the coordinates specified in where.</param> /// <param name="offsetY">A vertical offset from the coordinates specified in where.</param> public void MouseMove(ICoordinates where, int offsetX, int offsetY) { // Method intentionally left empty. }
public LocationHeadingEventArg(ICoordinates location, CardinalHeading heading) { Location = location; Heading = heading; }
/// <summary> /// Double-clicks at a set of coordinates. /// </summary> /// <param name="where">A OpenQA.Selenium.Interactions.Internal.ICoordinates describing where to double-click.</param> public void DoubleClick(ICoordinates where) { // Method intentionally left empty. }
public Location(ICoordinates coordinates1, ICoordinates coordinates2) { Coordinate1 = coordinates1; Coordinate2 = coordinates2; }
private IEnumerable <KeyValuePair <ILocation, Action <ITweet> > > GetMatchedLocations(ICoordinates coordinates) { if (_locations.IsEmpty() || coordinates == null) { return(new List <KeyValuePair <ILocation, Action <ITweet> > >()); } return(_locations.Where(x => Location.CoordinatesLocatedIn(coordinates, x.Key)).ToList()); }
/// <summary> /// Function returning a cell action indicating in which direction the cell should move to approach the given coordinates /// </summary> /// <param name="coordinates">The target coordinates</param> /// <returns>A cell action indicating how the cell should move to get there</returns> public AvailableActions GetRelativeMovment(ICoordinates coordinates) { var actions = new List<AvailableActions>(); if (coordinates.Y > this.Position.Y) actions.Add(AvailableActions.MOVEDOWN); if (coordinates.Y < this.Position.Y) actions.Add(AvailableActions.MOVEUP); if (coordinates.X < this.Position.X) actions.Add(AvailableActions.MOVELEFT); if (coordinates.X > this.Position.X) actions.Add(AvailableActions.MOVERIGHT); if (actions.Count > 0) return actions[RandomGenerator.GetRandomInt32(actions.Count)]; return AvailableActions.NONE; }
public Location(double latitude1, double longitude1, double latitude2, double longitude2) { Coordinate1 = new Coordinates(latitude1, longitude1); Coordinate2 = new Coordinates(latitude2, longitude2); }
/// <summary> /// /// </summary> /// <param name="targetCoordinates"></param> /// <returns></returns> private bool TerrainAllowsMovingTo(ICoordinates targetCoordinates) { bool canMove = true; IMap thisMap = this.world.GetMap(); // If the geometry does not allow to move if (Math.Abs(thisMap.GetTileAt(this.Position.X, this.Position.Y).GetAltitude() - thisMap.GetTileAt(targetCoordinates.X, targetCoordinates.Y).GetAltitude()) > 1) canMove = false; return canMove; }
public static bool CoordinatesLocatedIn(ICoordinates coordinates, ILocation location) { return(CoordinatesLocatedIn(coordinates, location.Coordinate1, location.Coordinate2)); }
/// <summary> /// Notify the world that a cell moved /// </summary> /// <param name="oldCoordinates">The old coordinates where the cell was</param> /// <param name="newCoordinates">The new coordinates where the cell is</param> /// <param name="team">The qualifier of the team</param> private void NotifyMovement(ICoordinates oldCoordinates, ICoordinates newCoordinates, DisplayQualifier team) { world.RegisterCellMovement(oldCoordinates, newCoordinates, team); return; }
public static Coordinates Add(ICoordinates right, ICoordinates left) { return(new Coordinates(x: right.X + left.X, y: right.Y + left.Y)); }