private static void Move(IHI_PathfinderValues values)
     {
         values.tiles[values.X[values.binaryHeap[1]]][values.Y[values.binaryHeap[1]]] = 2;


         values.binaryHeap[1] = values.binaryHeap[values.count];
         values.count--;

         short location = 1;
         while (true)
         {
             short high = location;
             if (2*high + 1 <= values.count)
             {
                 if (values.F[values.binaryHeap[high]] >= values.F[values.binaryHeap[2*high]])
                     location = (short) (2*high);
                 if (values.F[values.binaryHeap[location]] >= values.F[values.binaryHeap[2*high + 1]])
                     location = (short) (2*high + 1);
             }
             else if (2*high <= values.count)
             {
                 if (values.F[values.binaryHeap[high]] >= values.F[values.binaryHeap[2*high]])
                     location = (short) (2*high);
             }

             if (high == location)
                 break;
             
             short temp = values.binaryHeap[high];
             values.binaryHeap[high] = values.binaryHeap[location];
             values.binaryHeap[location] = temp;
         }
     }