Britbot
static Location Britbot.HeadingVector.AddvanceByVector ( Location  loc,
HeadingVector  hv 
) [inline, static]

given your location and your heading this function calculates your new position after going with the vector. consider the bounderies of the game

Parameters:
locyour location
hvyour heading
Returns:
new location after moving vy the heading vector

Definition at line 228 of file HeadingVector.cs.

        {
            //calculate new col
            int col = loc.Col + (int) hv.X;
            int row = loc.Row + (int) hv.Y;

            //check if out of boundries
            //first check negative valuse
            col = Math.Max(col, 0);
            row = Math.Max(row, 0);

            //check to big boundries
            col = Math.Min(col, Bot.Game.GetCols() - 1);
            row = Math.Min(row, Bot.Game.GetRows() - 1);

            //return new location
            return new Location(row, col);
        }