Britbot
static Location Britbot.Extensions.AdvancePivot ( this Location  pivot) [inline, static]

Moves a location closer to the center of the map.

Parameters:
pivot
Returns:

Definition at line 153 of file Extentions.cs.

        {
            //this basically moves the location closer to the center of the map
            int maxCols = Bot.Game.GetCols();
            int maxRows = Bot.Game.GetRows();

            int addCol = 0, addRow = 0;
            int deltaCol = maxCols - pivot.Col;
            int deltaRow = maxRows - pivot.Row;

            if (deltaCol > pivot.Col)
                addCol++;
            else if (deltaCol < pivot.Col)
                addCol--;

            if (deltaRow > pivot.Row)
                addRow++;
            else if (deltaRow < pivot.Row)
                addRow--;

            pivot = new Location(pivot.Row + addRow, pivot.Col + addCol);
            return pivot;
        }