public static void Allocate(this byte[,] fabric, FabricClaim claim) { for (var x = 0; x < claim.Height; x++) { for (var y = 0; y < claim.Width; y++) { fabric[claim.Left + x, claim.Top + y]++; } } }
public static bool IsOverAllocated(this byte[,] fabric, FabricClaim claim) { for (var x = 0; x < claim.Height; x++) { for (var y = 0; y < claim.Width; y++) { if (fabric[claim.Left + x, claim.Top + y] != 1) { return(true); } } } return(false); }