Loading

Paste #po85kouwx

  1.     int best_h;
  2.     int last_sum = MAX_TILE_HEIGHT;
  3.     for (int h = min_h; h <= max_h; h++) {
  4.         int sum = 0;
  5.         for (int c = 0; c < lengthof(corners); c++) {
  6.             sum += abs(h - corners[c]);
  7.         }
  8.         if (sum < last_sum) {
  9.             last_sum = sum;
  10.             best_h = h;
  11.         }
  12.     }

Comments