Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
228 lines (223 sloc) 8.57 KB
import { Rect } from '../src/models';
export interface PlotPurchaseInfo {
purchaser: number;
rect: Rect;
}
export const generatePlotsToBuy = (numberOfPlots: number, numberOfAccounts: number): PlotPurchaseInfo[] => {
const result: PlotPurchaseInfo[] = [];
for (let i = 0; i < numberOfPlots; i++) {
const x = Math.round(Math.random() * 249);
const y = Math.round(Math.random() * 249);
const w = Math.min(250 - x, 1 + Math.round(Math.random() * 30));
const h = Math.min(250 - y, 1 + Math.round(Math.random() * 30));
const x2 = x + w;
const y2 = y + h;
result.push({
purchaser: Math.floor(Math.random() * numberOfAccounts),
rect: {
x, y, w, h, x2, y2
}
});
}
return result;
};
export const generated100: PlotPurchaseInfo[] = [{ purchaser: 3,
rect: { x: 181, y: 205, w: 7, h: 8, x2: 188, y2: 213 } },
{ purchaser: 9,
rect: { x: 68, y: 103, w: 25, h: 8, x2: 93, y2: 111 } },
{ purchaser: 9,
rect: { x: 233, y: 161, w: 6, h: 27, x2: 239, y2: 188 } },
{ purchaser: 9,
rect: { x: 10, y: 227, w: 7, h: 5, x2: 17, y2: 232 } },
{ purchaser: 1,
rect: { x: 170, y: 242, w: 23, h: 8, x2: 193, y2: 250 } },
{ purchaser: 4,
rect: { x: 192, y: 180, w: 23, h: 18, x2: 215, y2: 198 } },
{ purchaser: 5,
rect: { x: 138, y: 164, w: 25, h: 9, x2: 163, y2: 173 } },
{ purchaser: 9,
rect: { x: 11, y: 6, w: 4, h: 24, x2: 15, y2: 30 } },
{ purchaser: 0,
rect: { x: 132, y: 197, w: 14, h: 10, x2: 146, y2: 207 } },
{ purchaser: 7,
rect: { x: 194, y: 133, w: 29, h: 6, x2: 223, y2: 139 } },
{ purchaser: 2,
rect: { x: 71, y: 143, w: 9, h: 29, x2: 80, y2: 172 } },
{ purchaser: 7,
rect: { x: 191, y: 208, w: 26, h: 5, x2: 217, y2: 213 } },
{ purchaser: 0,
rect: { x: 65, y: 198, w: 16, h: 29, x2: 81, y2: 227 } },
{ purchaser: 4,
rect: { x: 135, y: 110, w: 9, h: 3, x2: 144, y2: 113 } },
{ purchaser: 7,
rect: { x: 99, y: 102, w: 8, h: 12, x2: 107, y2: 114 } },
{ purchaser: 1,
rect: { x: 186, y: 49, w: 7, h: 5, x2: 193, y2: 54 } },
{ purchaser: 8,
rect: { x: 191, y: 52, w: 20, h: 29, x2: 211, y2: 81 } },
{ purchaser: 4,
rect: { x: 180, y: 210, w: 30, h: 28, x2: 210, y2: 238 } },
{ purchaser: 6,
rect: { x: 98, y: 122, w: 24, h: 2, x2: 122, y2: 124 } },
{ purchaser: 6,
rect: { x: 26, y: 227, w: 5, h: 23, x2: 31, y2: 250 } },
{ purchaser: 8,
rect: { x: 113, y: 91, w: 27, h: 8, x2: 140, y2: 99 } },
{ purchaser: 3,
rect: { x: 138, y: 224, w: 8, h: 2, x2: 146, y2: 226 } },
{ purchaser: 4,
rect: { x: 36, y: 157, w: 27, h: 14, x2: 63, y2: 171 } },
{ purchaser: 1,
rect: { x: 239, y: 152, w: 11, h: 21, x2: 250, y2: 173 } },
{ purchaser: 2,
rect: { x: 42, y: 219, w: 19, h: 23, x2: 61, y2: 242 } },
{ purchaser: 1,
rect: { x: 62, y: 8, w: 19, h: 5, x2: 81, y2: 13 } },
{ purchaser: 9,
rect: { x: 79, y: 87, w: 17, h: 30, x2: 96, y2: 117 } },
{ purchaser: 4,
rect: { x: 95, y: 236, w: 29, h: 9, x2: 124, y2: 245 } },
{ purchaser: 4,
rect: { x: 208, y: 135, w: 30, h: 16, x2: 238, y2: 151 } },
{ purchaser: 5,
rect: { x: 55, y: 117, w: 4, h: 1, x2: 59, y2: 118 } },
{ purchaser: 2,
rect: { x: 6, y: 118, w: 26, h: 17, x2: 32, y2: 135 } },
{ purchaser: 4,
rect: { x: 77, y: 165, w: 18, h: 9, x2: 95, y2: 174 } },
{ purchaser: 9,
rect: { x: 121, y: 164, w: 21, h: 3, x2: 142, y2: 167 } },
{ purchaser: 9,
rect: { x: 63, y: 229, w: 21, h: 3, x2: 84, y2: 232 } },
{ purchaser: 3,
rect: { x: 106, y: 106, w: 9, h: 11, x2: 115, y2: 117 } },
{ purchaser: 5,
rect: { x: 223, y: 224, w: 27, h: 14, x2: 250, y2: 238 } },
{ purchaser: 1,
rect: { x: 76, y: 107, w: 9, h: 16, x2: 85, y2: 123 } },
{ purchaser: 8,
rect: { x: 249, y: 166, w: 1, h: 11, x2: 250, y2: 177 } },
{ purchaser: 7,
rect: { x: 184, y: 118, w: 15, h: 13, x2: 199, y2: 131 } },
{ purchaser: 3,
rect: { x: 51, y: 46, w: 19, h: 10, x2: 70, y2: 56 } },
{ purchaser: 7,
rect: { x: 170, y: 117, w: 26, h: 25, x2: 196, y2: 142 } },
{ purchaser: 2,
rect: { x: 227, y: 106, w: 15, h: 2, x2: 242, y2: 108 } },
{ purchaser: 4,
rect: { x: 155, y: 94, w: 30, h: 1, x2: 185, y2: 95 } },
{ purchaser: 4,
rect: { x: 6, y: 2, w: 29, h: 19, x2: 35, y2: 21 } },
{ purchaser: 8,
rect: { x: 222, y: 183, w: 1, h: 12, x2: 223, y2: 195 } },
{ purchaser: 5,
rect: { x: 50, y: 129, w: 14, h: 23, x2: 64, y2: 152 } },
{ purchaser: 2,
rect: { x: 119, y: 200, w: 31, h: 17, x2: 150, y2: 217 } },
{ purchaser: 3,
rect: { x: 128, y: 168, w: 1, h: 28, x2: 129, y2: 196 } },
{ purchaser: 6,
rect: { x: 231, y: 37, w: 19, h: 13, x2: 250, y2: 50 } },
{ purchaser: 2,
rect: { x: 228, y: 130, w: 9, h: 28, x2: 237, y2: 158 } },
{ purchaser: 5,
rect: { x: 158, y: 49, w: 18, h: 23, x2: 176, y2: 72 } },
{ purchaser: 6,
rect: { x: 54, y: 8, w: 6, h: 5, x2: 60, y2: 13 } },
{ purchaser: 7,
rect: { x: 237, y: 77, w: 13, h: 4, x2: 250, y2: 81 } },
{ purchaser: 5,
rect: { x: 15, y: 14, w: 19, h: 19, x2: 34, y2: 33 } },
{ purchaser: 4,
rect: { x: 130, y: 109, w: 10, h: 23, x2: 140, y2: 132 } },
{ purchaser: 3,
rect: { x: 65, y: 235, w: 27, h: 15, x2: 92, y2: 250 } },
{ purchaser: 9,
rect: { x: 197, y: 90, w: 10, h: 19, x2: 207, y2: 109 } },
{ purchaser: 3,
rect: { x: 133, y: 41, w: 3, h: 27, x2: 136, y2: 68 } },
{ purchaser: 9,
rect: { x: 64, y: 223, w: 23, h: 27, x2: 87, y2: 250 } },
{ purchaser: 1,
rect: { x: 99, y: 114, w: 12, h: 25, x2: 111, y2: 139 } },
{ purchaser: 6,
rect: { x: 149, y: 163, w: 10, h: 18, x2: 159, y2: 181 } },
{ purchaser: 6,
rect: { x: 80, y: 123, w: 7, h: 11, x2: 87, y2: 134 } },
{ purchaser: 9,
rect: { x: 209, y: 93, w: 1, h: 12, x2: 210, y2: 105 } },
{ purchaser: 3,
rect: { x: 163, y: 214, w: 7, h: 23, x2: 170, y2: 237 } },
{ purchaser: 6,
rect: { x: 64, y: 123, w: 29, h: 8, x2: 93, y2: 131 } },
{ purchaser: 4,
rect: { x: 166, y: 174, w: 12, h: 26, x2: 178, y2: 200 } },
{ purchaser: 4,
rect: { x: 3, y: 35, w: 22, h: 19, x2: 25, y2: 54 } },
{ purchaser: 3,
rect: { x: 23, y: 110, w: 11, h: 11, x2: 34, y2: 121 } },
{ purchaser: 4,
rect: { x: 196, y: 195, w: 25, h: 29, x2: 221, y2: 224 } },
{ purchaser: 4,
rect: { x: 77, y: 40, w: 22, h: 27, x2: 99, y2: 67 } },
{ purchaser: 1,
rect: { x: 217, y: 80, w: 1, h: 4, x2: 218, y2: 84 } },
{ purchaser: 4,
rect: { x: 87, y: 214, w: 10, h: 23, x2: 97, y2: 237 } },
{ purchaser: 5,
rect: { x: 160, y: 157, w: 5, h: 16, x2: 165, y2: 173 } },
{ purchaser: 1,
rect: { x: 4, y: 101, w: 16, h: 4, x2: 20, y2: 105 } },
{ purchaser: 6,
rect: { x: 208, y: 160, w: 2, h: 7, x2: 210, y2: 167 } },
{ purchaser: 2,
rect: { x: 118, y: 87, w: 22, h: 7, x2: 140, y2: 94 } },
{ purchaser: 4,
rect: { x: 11, y: 84, w: 18, h: 2, x2: 29, y2: 86 } },
{ purchaser: 8,
rect: { x: 76, y: 8, w: 5, h: 9, x2: 81, y2: 17 } },
{ purchaser: 4,
rect: { x: 154, y: 32, w: 22, h: 31, x2: 176, y2: 63 } },
{ purchaser: 7,
rect: { x: 106, y: 44, w: 2, h: 2, x2: 108, y2: 46 } },
{ purchaser: 2,
rect: { x: 41, y: 245, w: 21, h: 5, x2: 62, y2: 250 } },
{ purchaser: 7,
rect: { x: 2, y: 125, w: 12, h: 2, x2: 14, y2: 127 } },
{ purchaser: 4,
rect: { x: 238, y: 181, w: 12, h: 10, x2: 250, y2: 191 } },
{ purchaser: 7,
rect: { x: 54, y: 102, w: 23, h: 6, x2: 77, y2: 108 } },
{ purchaser: 5,
rect: { x: 239, y: 109, w: 11, h: 22, x2: 250, y2: 131 } },
{ purchaser: 8,
rect: { x: 65, y: 145, w: 18, h: 24, x2: 83, y2: 169 } },
{ purchaser: 8,
rect: { x: 192, y: 93, w: 18, h: 29, x2: 210, y2: 122 } },
{ purchaser: 3,
rect: { x: 109, y: 201, w: 7, h: 12, x2: 116, y2: 213 } },
{ purchaser: 4,
rect: { x: 95, y: 59, w: 12, h: 5, x2: 107, y2: 64 } },
{ purchaser: 6,
rect: { x: 161, y: 128, w: 22, h: 27, x2: 183, y2: 155 } },
{ purchaser: 7,
rect: { x: 86, y: 178, w: 14, h: 25, x2: 100, y2: 203 } },
{ purchaser: 7,
rect: { x: 103, y: 116, w: 10, h: 26, x2: 113, y2: 142 } },
{ purchaser: 9,
rect: { x: 174, y: 235, w: 21, h: 6, x2: 195, y2: 241 } },
{ purchaser: 1,
rect: { x: 213, y: 182, w: 7, h: 31, x2: 220, y2: 213 } },
{ purchaser: 8,
rect: { x: 140, y: 186, w: 15, h: 10, x2: 155, y2: 196 } },
{ purchaser: 2,
rect: { x: 186, y: 75, w: 17, h: 30, x2: 203, y2: 105 } },
{ purchaser: 7,
rect: { x: 168, y: 155, w: 17, h: 6, x2: 185, y2: 161 } },
{ purchaser: 4,
rect: { x: 19, y: 55, w: 1, h: 27, x2: 20, y2: 82 } },
{ purchaser: 2,
rect: { x: 203, y: 221, w: 1, h: 24, x2: 204, y2: 245 } },
{ purchaser: 7,
rect: { x: 30, y: 24, w: 26, h: 7, x2: 56, y2: 31 } }];