<gh_stars>1-10
import json

buildings = ["HEADQUARTER", "BARRACKS", "STABLE", "WORKSHOP", "ACADEMY", "SMITHY", "RALLY_POINT", "STATUE", "MARKET",
             "TIMBER_CAMP", "CLAY_PIT", "IRON_MINE", "FARM", "WAREHOUSE", "HIDING_PLACE", "WALL"]

requirements = [
    {},
    {"HEADQUARTER": 3},
    {"HEADQUARTER": 10, "BARRACKS": 5, "SMITHY": 5},
    {"HEADQUARTER": 10, "SMITHY": 10},
    {"HEADQUARTER": 20, "SMITHY": 20, "MARKET": 10},
    {"HEADQUARTER": 5, "BARRACKS": 1},
    {},
    {},
    {"HEADQUARTER": 3, "WAREHOUSE": 2},
    {},
    {},
    {},
    {},
    {},
    {},
    {"BARRACKS": 1}
]

levels = [
    [
        [[90, 80, 70, 5, 5], 0.95],
        [[113, 102, 88, 1, 6], 0.91],
        [[143, 130, 111, 1, 7], 0.86],
        [[180, 166, 140, 1, 8], 0.82],
        [[227, 211, 176, 1, 9], 0.78],
        [[286, 270, 222, 2, 11], 0.75],
        [[360, 344, 280, 2, 13], 0.71],
        [[454, 438, 353, 2, 15], 0.68],
        [[572, 559, 445, 3, 18], 0.64],
        [[720, 712, 560, 3, 21], 0.61],
        [[908, 908, 706, 3, 24], 0.58],
        [[1144, 1158, 890, 4, 28], 0.56],
        [[1441, 1476, 1121, 5, 33], 0.53],
        [[1816, 1882, 1412, 5, 38], 0.51],
        [[2288, 2400, 1779, 7, 45], 0.48],
        [[2883, 3060, 2242, 8, 53], 0.46],
        [[3632, 3902, 2825, 9, 62], 0.44],
        [[4577, 4975, 3560, 10, 72], 0.42],
        [[5767, 6343, 4485, 12, 84], 0.40],
        [[7266, 8087, 5651, 15, 99], 0.38],
        [[9155, 10, 311, 7120, 17, 116], 0.36],
        [[11535, 13146, 8972, 19, 135], 0.34],
        [[14534, 16762, 11304, 23, 158], 0.33],
        [[18313, 21371, 14244, 27, 185], 0.31],
        [[23075, 27248, 17947, 31, 216], 0.30],
        [[29074, 34741, 22613, 37, 253], 0.28],
        [[36633, 44295, 28493, 43, 296], 0.27],
        [[46158, 56476, 35901, 51, 347], 0.26],
        [[58159, 72007, 45235, 59, 406], 0.24],
        [[73280, 91809, 56996, 69, 475], 0.23]
    ],
    [
        [[200, 170, 90, 7, 7], 0.63],
        [[252, 218, 113, 1, 8], 0.59],
        [[318, 279, 143, 2, 10], 0.56],
        [[400, 357, 180, 1, 11], 0.53],
        [[504, 456, 227, 2, 13], 0.50],
        [[635, 584, 286, 2, 15], 0.47],
        [[800, 748, 360, 3, 18], 0.44],
        [[1008, 957, 454, 3, 21], 0.42],
        [[1271, 1225, 572, 4, 25], 0.39],
        [[1601, 1568, 720, 4, 29], 0.37],
        [[2017, 2007, 908, 5, 34], 0.35],
        [[2542, 2569, 1144, 5, 39], 0.33],
        [[3202, 3288, 1441, 7, 46], 0.31],
        [[4035, 4209, 1816, 8, 54], 0.29],
        [[5084, 5388, 2288, 9, 63], 0.28],
        [[6406, 6896, 2883, 11, 74], 0.26],
        [[8072, 8827, 3632, 12, 86], 0.25],
        [[10170, 11298, 4577, 15, 101], 0.23],
        [[12814, 14462, 5767, 17, 118], 0.22],
        [[16146, 18511, 7266, 20, 138], 0.21],
        [[20344, 23695, 9155, 24, 162], 0.20],
        [[25634, 30329, 11535, 27, 189], 0.19],
        [[32298, 38821, 14534, 32, 221], 0.17],
        [[40696, 49691, 18313, 38, 259], 0.16],
        [[51277, 63605, 23075, 44, 303], 0.15]
    ],
    [
        [[270, 240, 260, 8, 8], 0.63],
        [[340, 307, 328, 1, 9], 0.59],
        [[429, 393, 413, 2, 11], 0.56],
        [[540, 503, 520, 2, 13], 0.53],
        [[681, 644, 655, 2, 15], 0.5],
        [[857, 825, 826, 3, 18], 0.47],
        [[1080, 1056, 1040, 3, 21], 0.44],
        [[1361, 1351, 1311, 3, 24], 0.42],
        [[1715, 1729, 1652, 4, 28], 0.39],
        [[2161, 2214, 2081, 5, 33], 0.37],
        [[2723, 2833, 2622, 5, 38], 0.35],
        [[3431, 3627, 3304, 7, 45], 0.33],
        [[4323, 4642, 4163, 8, 53], 0.31],
        [[5447, 5942, 5246, 9, 62], 0.29],
        [[6864, 7606, 6609, 10, 72], 0.28],
        [[8648, 9736, 8328, 12, 84], 0.26],
        [[10897, 12462, 10493, 15, 99], 0.25],
        [[13730, 15951, 13221, 16, 115], 0.23],
        [[17300, 20417, 16659, 20, 135], 0.22],
        [[21797, 26134, 20990, 23, 158], 0.21]
    ],
    [
        [[300, 240, 260, 8, 8], 0.63],
        [[378, 307, 328, 1, 9], 0.59],
        [[476, 393, 413, 2, 11], 0.56],
        [[600, 503, 520, 2, 13], 0.53],
        [[756, 644, 655, 2, 15], 0.5],
        [[953, 825, 826, 3, 18], 0.47],
        [[1200, 1056, 1040, 3, 21], 0.44],
        [[1513, 1351, 1311, 3, 24], 0.42],
        [[1906, 1729, 1652, 4, 28], 0.39],
        [[2401, 2214, 2081, 5, 33], 0.37],
        [[3026, 2833, 2622, 5, 38], 0.35],
        [[3812, 3627, 3304, 7, 45], 0.33],
        [[4804, 4642, 4163, 8, 53], 0.31],
        [[6053, 5942, 5246, 9, 62], 0.29],
        [[7626, 7606, 6609, 10, 72], 0.28]
    ],
    [
        [[15000, 25000, 10000, 80, 80], 0.63],
        [[30000, 50000, 20000, 14, 94], 0.59],
        [[60000, 100000, 40000, 16, 110], 0.56]
    ],
    [
        [[220, 180, 240, 20, 20], 0.91],
        [[277, 230, 302, 3, 23], 0.83],
        [[349, 293, 381, 4, 27], 0.75],
        [[440, 373, 480, 5, 32], 0.68],
        [[555, 476, 605, 5, 37], 0.62],
        [[699, 606, 762, 7, 44], 0.56],
        [[880, 773, 960, 7, 51], 0.51],
        [[1109, 986, 1210, 9, 60], 0.47],
        [[1398, 1257, 1525, 10, 70], 0.42],
        [[1761, 1603, 1921, 12, 82], 0.39],
        [[2219, 2043, 2421, 14, 96], 0.35],
        [[2796, 2605, 3050, 16, 112], 0.32],
        [[3523, 3322, 3843, 20, 132], 0.29],
        [[4439, 4236, 4842, 22, 154], 0.26],
        [[5593, 5400, 6101, 26, 180], 0.24],
        [[7047, 6885, 7687, 31, 211], 0.22],
        [[8879, 8779, 9686, 36, 247], 0.2],
        [[11187, 11193, 12204, 42, 289], 0.18],
        [[14096, 14271, 15377, 49, 338], 0.16],
        [[17761, 18196, 19375, 57, 395], 0.15]
    ],
    [
        [[10, 40, 30, 0, 0], 1.0]
    ],
    [
        [[220, 220, 220, 10, 10], 1.0]
    ],
    [
        [[100, 100, 100, 20, 20], 1],
        [[126, 128, 126, 3, 23], 2],
        [[159, 163, 159, 4, 27], 3],
        [[200, 207, 200, 5, 32], 4],
        [[252, 264, 252, 5, 37], 5],
        [[318, 337, 318, 7, 44], 6],
        [[400, 430, 400, 7, 51], 7],
        [[504, 548, 504, 9, 60], 8],
        [[635, 698, 635, 10, 70], 9],
        [[800, 890, 800, 12, 82], 10],
        [[1009, 1135, 1009, 14, 96], 11],
        [[1271, 1447, 1271, 16, 112], 14],
        [[1601, 1846, 1601, 20, 132], 19],
        [[2018, 2353, 2018, 22, 154], 26],
        [[2542, 3000, 2542, 26, 180], 35],
        [[3203, 3825, 3203, 31, 211], 46],
        [[4036, 4877, 4036, 36, 247], 59],
        [[5085, 6218, 5085, 42, 289], 74],
        [[6407, 7928, 6407, 49, 338], 91],
        [[8073, 10109, 8073, 57, 395], 110],
        [[10172, 12889, 10172, 67, 462], 131],
        [[12817, 16433, 12817, 79, 541], 154],
        [[16149, 20952, 16149, 92, 633], 179],
        [[20348, 26714, 20348, 107, 740], 206],
        [[25639, 34060, 25639, 126, 866], 235]
    ],
    [
        [[50, 60, 40, 5, 5], 30],
        [[63, 77, 50, 1, 6], 35],
        [[78, 98, 62, 1, 7], 41],
        [[98, 124, 77, 1, 8], 47],
        [[122, 159, 96, 1, 9], 55],
        [[153, 202, 120, 1, 10], 64],
        [[191, 258, 149, 2, 12], 74],
        [[238, 329, 185, 2, 14], 86],
        [[298, 419, 231, 2, 16], 100],
        [[373, 534, 287, 2, 18], 117],
        [[466, 681, 358, 3, 21], 136],
        [[582, 868, 446, 3, 24], 158],
        [[728, 1107, 555, 4, 28], 184],
        [[909, 1412, 691, 5, 33], 214],
        [[1137, 1800, 860, 5, 38], 249],
        [[1421, 2295, 1071, 5, 43], 289],
        [[1776, 2926, 1333, 7, 50], 337],
        [[2220, 3731, 1659, 8, 58], 391],
        [[2776, 4757, 2066, 9, 67], 455],
        [[3469, 6065, 2572, 10, 77], 530],
        [[4337, 7733, 3202, 12, 89], 616],
        [[5421, 9860, 3987, 14, 103], 717],
        [[6776, 12571, 4963, 16, 119], 833],
        [[8470, 16028, 6180, 19, 138], 969],
        [[10588, 20436, 7694, 21, 159], 1127],
        [[13235, 26056, 9578, 24, 183], 1311],
        [[16544, 33221, 11925, 29, 212], 1525],
        [[20680, 42357, 14847, 33, 245], 1774],
        [[25849, 54005, 18484, 38, 283], 2063],
        [[32312, 68857, 23013, 43, 326], 2400]
    ],
    [
        [[65, 50, 40, 10, 10], 30],
        [[83, 63, 50, 1, 11], 35],
        [[105, 80, 62, 2, 13], 41],
        [[133, 101, 76, 2, 15], 47],
        [[169, 128, 95, 2, 17], 55],
        [[215, 162, 117, 2, 19], 64],
        [[273, 205, 145, 3, 22], 74],
        [[346, 259, 180, 3, 25], 86],
        [[440, 328, 224, 4, 29], 100],
        [[559, 415, 277, 4, 33], 117],
        [[709, 525, 344, 4, 37], 136],
        [[901, 664, 426, 5, 42], 158],
        [[1144, 840, 529, 6, 48], 184],
        [[1453, 1062, 655, 7, 55], 214],
        [[1846, 1343, 813, 8, 63], 249],
        [[2344, 1700, 1008, 8, 71], 289],
        [[2977, 2150, 1250, 10, 81], 337],
        [[3781, 2720, 1550, 12, 93], 391],
        [[4802, 3440, 1922, 13, 106], 455],
        [[6098, 4352, 2383, 15, 121], 530],
        [[7744, 5505, 2955, 16, 137], 616],
        [[9835, 6964, 3664, 20, 157], 717],
        [[12491, 8810, 4543, 22, 179], 833],
        [[15863, 11144, 5633, 25, 204], 969],
        [[20147, 14098, 6985, 28, 232], 1127],
        [[25586, 17833, 8662, 33, 265], 1311],
        [[32495, 22559, 10740, 37, 302], 1525],
        [[41268, 28537, 13318, 42, 344], 1774],
        [[52410, 36100, 16515, 48, 392], 2063],
        [[66561, 45666, 20478, 55, 447], 2400]
    ],
    [
        [[75, 65, 70, 10, 10], 30],
        [[94, 83, 87, 2, 12], 35],
        [[118, 106, 108, 2, 14], 41],
        [[147, 135, 133, 2, 16], 47],
        [[184, 172, 165, 3, 19], 55],
        [[231, 219, 205, 3, 22], 64],
        [[289, 279, 254, 4, 26], 74],
        [[362, 356, 316, 4, 30], 86],
        [[453, 454, 391, 5, 35], 100],
        [[567, 579, 485, 6, 41], 117],
        [[710, 738, 602, 7, 48], 136],
        [[889, 941, 746, 8, 56], 158],
        [[1113, 1200, 925, 10, 66], 184],
        [[1393, 1529, 1147, 11, 77], 214],
        [[1744, 1950, 1422, 13, 90], 249],
        [[2183, 2486, 1764, 15, 105], 289],
        [[2734, 3170, 2187, 18, 123], 337],
        [[3422, 4042, 2712, 21, 144], 391],
        [[4285, 5153, 3363, 25, 169], 455],
        [[5365, 6571, 4170, 28, 197], 530],
        [[6717, 8378, 5170, 34, 231], 616],
        [[8409, 10681, 6411, 39, 270], 717],
        [[10528, 13619, 7950, 46, 316], 833],
        [[13181, 17364, 9858, 54, 370], 969],
        [[16503, 22139, 12224, 63, 433], 1127],
        [[20662, 28227, 15158, 74, 507], 1311],
        [[25869, 35990, 18796, 86, 593], 1525],
        [[32388, 45887, 23307, 100, 693], 1774],
        [[40549, 58506, 28900, 118, 811], 2063],
        [[50768, 74595, 35837, 138, 949], 2400]
    ],
    [
        [[45, 40, 30, 0, 0], 240],
        [[59, 53, 39, 0, 0], 281],
        [[76, 70, 50, 0, 0], 329],
        [[99, 92, 64, 0, 0], 386],
        [[129, 121, 83, 0, 0], 452],
        [[167, 160, 107, 0, 0], 530],
        [[217, 212, 138, 0, 0], 622],
        [[282, 279, 178, 0, 0], 729],
        [[367, 369, 230, 0, 0], 854],
        [[477, 487, 297, 0, 0], 1002],
        [[620, 642, 383, 0, 0], 1174],
        [[806, 848, 494, 0, 0], 1376],
        [[1048, 1119, 637, 0, 0], 1613],
        [[1363, 1477, 822, 0, 0], 1891],
        [[1772, 1950, 1060, 0, 0], 2216],
        [[2303, 2574, 1368, 0, 0], 2598],
        [[2994, 3398, 1764, 0, 0], 3045],
        [[3893, 4486, 2276, 0, 0], 3569],
        [[5060, 5921, 2936, 0, 0], 4183],
        [[6579, 7816, 3787, 0, 0], 4904],
        [[8552, 10317, 4886, 0, 0], 5748],
        [[11118, 13618, 6302, 0, 0], 6737],
        [[14453, 17976, 8130, 0, 0], 7896],
        [[18789, 23728, 10488, 0, 0], 9255],
        [[24426, 31321, 13529, 0, 0], 10848],
        [[31754, 41344, 17453, 0, 0], 12715],
        [[41280, 54574, 22514, 0, 0], 14904],
        [[53664, 72037, 29043, 0, 0], 17469],
        [[69763, 95089, 37466, 0, 0], 20476],
        [[90692, 125517, 48331, 0, 0], 24000]
    ],
    [
        [[60, 50, 40, 0, 0], 1000],
        [[76, 64, 50, 0, 0], 1229],
        [[96, 81, 62, 0, 0], 1512],
        [[121, 102, 77, 0, 0], 1859],
        [[154, 130, 96, 0, 0], 2285],
        [[194, 165, 120, 0, 0], 2810],
        [[246, 210, 149, 0, 0], 3454],
        [[311, 266, 185, 0, 0], 4247],
        [[393, 338, 231, 0, 0], 5222],
        [[498, 430, 287, 0, 0], 6420],
        [[630, 546, 358, 0, 0], 7893],
        [[796, 693, 446, 0, 0], 9705],
        [[1007, 880, 555, 0, 0], 11932],
        [[1274, 1118, 691, 0, 0], 14670],
        [[1612, 1420, 860, 0, 0], 18037],
        [[2039, 1803, 1071, 0, 0], 22177],
        [[2580, 2290, 1333, 0, 0], 27266],
        [[3264, 2908, 1659, 0, 0], 33523],
        [[4128, 3693, 2066, 0, 0], 41217],
        [[5222, 4691, 2572, 0, 0], 50675],
        [[6606, 5957, 3202, 0, 0], 62305],
        [[8357, 7566, 3987, 0, 0], 76604],
        [[10572, 9608, 4963, 0, 0], 94184],
        [[13373, 12203, 6180, 0, 0], 115798],
        [[16917, 15497, 7694, 0, 0], 142373],
        [[21400, 19682, 9578, 0, 0], 175047],
        [[27071, 24996, 11925, 0, 0], 215219],
        [[34245, 31745, 14847, 0, 0], 264611],
        [[43320, 40316, 18484, 0, 0], 325337],
        [[54799, 51201, 23013, 0, 0], 400000]
    ],
    [
        [[50, 60, 50, 2, 2], 150],
        [[63, 75, 63, 0, 2], 200],
        [[78, 94, 78, 1, 3], 267],
        [[98, 117, 98, 0, 3], 356],
        [[122, 146, 122, 1, 4], 474],
        [[153, 183, 153, 0, 4], 632],
        [[191, 229, 191, 1, 5], 843],
        [[238, 286, 238, 1, 6], 1125],
        [[298, 358, 298, 1, 7], 1500],
        [[373, 447, 373, 1, 8], 2000]
    ],
    [
        [[50, 100, 20, 5, 5], 0.04],
        [[63, 128, 25, 1, 6], 0.08],
        [[79, 163, 32, 1, 7], 0.12],
        [[100, 207, 40, 1, 8], 0.16],
        [[126, 264, 50, 1, 9], 0.2],
        [[159, 337, 64, 2, 11], 0.24],
        [[200, 430, 80, 2, 13], 0.29],
        [[252, 548, 101, 2, 15], 0.34],
        [[318, 698, 127, 3, 18], 0.39],
        [[400, 890, 160, 3, 21], 0.44],
        [[504, 1135, 202, 3, 24], 0.49],
        [[635, 1447, 254, 4, 28], 0.55],
        [[801, 1846, 320, 5, 33], 0.6],
        [[1009, 2353, 404, 5, 38], 0.66],
        [[1271, 3000, 508, 7, 45], 0.72],
        [[1602, 3825, 641, 8, 53], 0.79],
        [[2018, 4877, 807, 9, 62], 0.85],
        [[2543, 6218, 1017, 10, 72], 0.92],
        [[3204, 7928, 1281, 12, 84], 0.99],
        [[4037, 10109, 1615, 15, 99], 1.07]
    ],
]

data = {
    "requirements": {},
    "levels": []
}


def create_files():
    for i, name in enumerate(buildings):
        f = open(f"{name}.json", "w")
        data["requirements"].clear()
        data["requirements"].update(requirements[i])
        data["levels"] = levels[i]
        f.write(json.dumps(data))
        f.close()


def json_parser_for_buildings():
    s = """[
  [1,"{{Res|50|100|20}}","{{Workers|5|5}}","4%"  ],
  [2,"{{Res|63|128|25}}","{{Workers|1|6}}","8%"  ],
  [3,"{{Res|79|163|32}}","{{Workers|1|7}}","12%"  ],
  [4,"{{Res|100|207|40}}","{{Workers|1|8}}","16%"  ],
  [5,"{{Res|126|264|50}}","{{Workers|1|9}}","20%"  ],
  [6,"{{Res|159|337|64}}","{{Workers|2|11}}","24%"  ],
  [7,"{{Res|200|430|80}}","{{Workers|2|13}}","29%"  ],
  [8,"{{Res|252|548|101}}","{{Workers|2|15}}","34%"  ],
  [9,"{{Res|318|698|127}}","{{Workers|3|18}}","39%"  ],
  [10,"{{Res|400|890|160}}","{{Workers|3|21}}","44%"  ],
  [11,"{{Res|504|1135|202}}","{{Workers|3|24}}","49%"  ],
  [12,"{{Res|635|1447|254}}","{{Workers|4|28}}","55%"  ],
  [13,"{{Res|801|1846|320}}","{{Workers|5|33}}","60%"  ],
  [14,"{{Res|1009|2353|404}}","{{Workers|5|38}}","66%"  ],
  [15,"{{Res|1271|3000|508}}","{{Workers|7|45}}","72%"  ],
  [16,"{{Res|1602|3825|641}}","{{Workers|8|53}}","79%"  ],
  [17,"{{Res|2018|4877|807}}","{{Workers|9|62}}","85%"  ],
  [18,"{{Res|2543|6218|1017}}","{{Workers|10|72}}","92%"  ],
  [19,"{{Res|3204|7928|1281}}","{{Workers|12|84}}","99%"  ],
  [20,"{{Res|4037|10109|1615}}","{{Workers|15|99}}","107%"  ]
]"""
    json_object = json.loads(s)
    result = ""
    for index, element in enumerate(json_object):
        wood, clay, iron = str(element[1][6:-2]).split("|")
        pop = str(element[2][10:-2]).split("|")[0]
        factor = float(element[3][0:-1]) / 100
        print(f"[[{wood},{clay},{iron},{pop}], {factor}],")


def json_parser_for_points():
    s = """[
  ["1,10,16,20,24,10,10,42,512,19,0,24,10,6,6,6,5,6,5,8","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["2,2,3,4,5,2,,8,,4,,,2,1,1,1,1,1,1,2","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["3,2,4,5,6,2,,10,,4,,,2,2,2,2,1,2,1,2","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["4,3,5,6,6,,,13,,6,,,3,1,1,1,2,1,2,2","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["5,4,5,6,9,,,14,,6,,,4,2,2,2,1,2,1,3","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["6,4,7,9,10,,,18,,8,,,4,3,3,3,2,3,2,3","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["7,5,8,10,12,,,20,,10,,,5,3,3,3,3,3,3,4","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["8,6,9,12,14,,,25,,11,,,6,3,3,3,3,3,3,5","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["9,7,12,14,17,,,31,,14,,,7,5,5,5,3,5,3,5","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["10,9,14,17,21,,,36,,16,,,9,5,5,5,5,5,5,7","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["11,10,16,21,25,,,43,,20,,,10,6,6,6,5,6,,9","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["12,12,20,25,29,,,52,,23,,,12,8,8,8,6,8,,9","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["13,15,24,29,36,,,62,,28,,,15,8,8,8,8,8,,12","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["14,18,28,36,43,,,75,,34,,,18,11,11,11,8,11,,15","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["15,21,34,43,51,,,90,,41,,,21,13,13,13,11,13,,17","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["16,26,42,51,,,,108,,49,,,26,15,15,15,13,15,,20","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["17,31,49,62,,,,130,,58,,,31,19,19,19,15,19,,25","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["18,37,59,74,,,,155,,71,,,37,22,22,22,19,22,,29","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["19,44,71,88,,,,186,,84,,,44,27,27,27,22,27,,36","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["20,53,85,107,,,,224,,101,,,53,32,32,32,27,32,,43","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["21,64,102,,,,,,,,,,64,38,38,38,32,38,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["22,77,123,,,,,,,,,,77,46,46,46,38,46,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["23,92,147,,,,,,,,,,92,55,55,55,46,55,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["24,110,177,,,,,,,,,,110,66,66,66,55,66,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["25,133,212,,,,,,,,,,133,80,80,80,66,80,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["26,159,,,,,,,,,,,,95,95,95,80,95,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["27,191,,,,,,,,,,,,115,115,115,95,115,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["28,229,,,,,,,,,,,,137,137,137,115,137,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["29,274,,,,,,,,,,,,165,165,165,137,165,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["30,330,,,,,,,,,,,,198,198,198,165,198,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ]
]"""
    json_object = json.loads(s)
    matrix = [[0 for x in range(30)] for y in range(16)]
    y = 0
    x = 0
    for index_y, element_y in enumerate(json_object):
        l = str(element_y[0][1:]).split("'")[0].split(",")
        for index_x, element_x in enumerate(l):
            if index_x == 0 or 5 <= index_x <= 7:
                continue

            matrix[y][x] = 0 if element_x == '' else int(element_x)
            y += 1

        x += 1
        y = 0

    f = open(f"POINTS.json", "w")
    f.write(json.dumps(matrix))
    f.close()

# create_files()
# json_parser_for_buildings()
# json_parser_for_points()

import json

buildings = ["HEADQUARTER", "BARRACKS", "STABLE", "WORKSHOP", "ACADEMY", "SMITHY", "RALLY_POINT", "STATUE", "MARKET",
             "TIMBER_CAMP", "CLAY_PIT", "IRON_MINE", "FARM", "WAREHOUSE", "HIDING_PLACE", "WALL"]

requirements = [
    {},
    {"HEADQUARTER": 3},
    {"HEADQUARTER": 10, "BARRACKS": 5, "SMITHY": 5},
    {"HEADQUARTER": 10, "SMITHY": 10},
    {"HEADQUARTER": 20, "SMITHY": 20, "MARKET": 10},
    {"HEADQUARTER": 5, "BARRACKS": 1},
    {},
    {},
    {"HEADQUARTER": 3, "WAREHOUSE": 2},
    {},
    {},
    {},
    {},
    {},
    {},
    {"BARRACKS": 1}
]

levels = [
    [
        [[90, 80, 70, 5, 5], 0.95],
        [[113, 102, 88, 1, 6], 0.91],
        [[143, 130, 111, 1, 7], 0.86],
        [[180, 166, 140, 1, 8], 0.82],
        [[227, 211, 176, 1, 9], 0.78],
        [[286, 270, 222, 2, 11], 0.75],
        [[360, 344, 280, 2, 13], 0.71],
        [[454, 438, 353, 2, 15], 0.68],
        [[572, 559, 445, 3, 18], 0.64],
        [[720, 712, 560, 3, 21], 0.61],
        [[908, 908, 706, 3, 24], 0.58],
        [[1144, 1158, 890, 4, 28], 0.56],
        [[1441, 1476, 1121, 5, 33], 0.53],
        [[1816, 1882, 1412, 5, 38], 0.51],
        [[2288, 2400, 1779, 7, 45], 0.48],
        [[2883, 3060, 2242, 8, 53], 0.46],
        [[3632, 3902, 2825, 9, 62], 0.44],
        [[4577, 4975, 3560, 10, 72], 0.42],
        [[5767, 6343, 4485, 12, 84], 0.40],
        [[7266, 8087, 5651, 15, 99], 0.38],
        [[9155, 10, 311, 7120, 17, 116], 0.36],
        [[11535, 13146, 8972, 19, 135], 0.34],
        [[14534, 16762, 11304, 23, 158], 0.33],
        [[18313, 21371, 14244, 27, 185], 0.31],
        [[23075, 27248, 17947, 31, 216], 0.30],
        [[29074, 34741, 22613, 37, 253], 0.28],
        [[36633, 44295, 28493, 43, 296], 0.27],
        [[46158, 56476, 35901, 51, 347], 0.26],
        [[58159, 72007, 45235, 59, 406], 0.24],
        [[73280, 91809, 56996, 69, 475], 0.23]
    ],
    [
        [[200, 170, 90, 7, 7], 0.63],
        [[252, 218, 113, 1, 8], 0.59],
        [[318, 279, 143, 2, 10], 0.56],
        [[400, 357, 180, 1, 11], 0.53],
        [[504, 456, 227, 2, 13], 0.50],
        [[635, 584, 286, 2, 15], 0.47],
        [[800, 748, 360, 3, 18], 0.44],
        [[1008, 957, 454, 3, 21], 0.42],
        [[1271, 1225, 572, 4, 25], 0.39],
        [[1601, 1568, 720, 4, 29], 0.37],
        [[2017, 2007, 908, 5, 34], 0.35],
        [[2542, 2569, 1144, 5, 39], 0.33],
        [[3202, 3288, 1441, 7, 46], 0.31],
        [[4035, 4209, 1816, 8, 54], 0.29],
        [[5084, 5388, 2288, 9, 63], 0.28],
        [[6406, 6896, 2883, 11, 74], 0.26],
        [[8072, 8827, 3632, 12, 86], 0.25],
        [[10170, 11298, 4577, 15, 101], 0.23],
        [[12814, 14462, 5767, 17, 118], 0.22],
        [[16146, 18511, 7266, 20, 138], 0.21],
        [[20344, 23695, 9155, 24, 162], 0.20],
        [[25634, 30329, 11535, 27, 189], 0.19],
        [[32298, 38821, 14534, 32, 221], 0.17],
        [[40696, 49691, 18313, 38, 259], 0.16],
        [[51277, 63605, 23075, 44, 303], 0.15]
    ],
    [
        [[270, 240, 260, 8, 8], 0.63],
        [[340, 307, 328, 1, 9], 0.59],
        [[429, 393, 413, 2, 11], 0.56],
        [[540, 503, 520, 2, 13], 0.53],
        [[681, 644, 655, 2, 15], 0.5],
        [[857, 825, 826, 3, 18], 0.47],
        [[1080, 1056, 1040, 3, 21], 0.44],
        [[1361, 1351, 1311, 3, 24], 0.42],
        [[1715, 1729, 1652, 4, 28], 0.39],
        [[2161, 2214, 2081, 5, 33], 0.37],
        [[2723, 2833, 2622, 5, 38], 0.35],
        [[3431, 3627, 3304, 7, 45], 0.33],
        [[4323, 4642, 4163, 8, 53], 0.31],
        [[5447, 5942, 5246, 9, 62], 0.29],
        [[6864, 7606, 6609, 10, 72], 0.28],
        [[8648, 9736, 8328, 12, 84], 0.26],
        [[10897, 12462, 10493, 15, 99], 0.25],
        [[13730, 15951, 13221, 16, 115], 0.23],
        [[17300, 20417, 16659, 20, 135], 0.22],
        [[21797, 26134, 20990, 23, 158], 0.21]
    ],
    [
        [[300, 240, 260, 8, 8], 0.63],
        [[378, 307, 328, 1, 9], 0.59],
        [[476, 393, 413, 2, 11], 0.56],
        [[600, 503, 520, 2, 13], 0.53],
        [[756, 644, 655, 2, 15], 0.5],
        [[953, 825, 826, 3, 18], 0.47],
        [[1200, 1056, 1040, 3, 21], 0.44],
        [[1513, 1351, 1311, 3, 24], 0.42],
        [[1906, 1729, 1652, 4, 28], 0.39],
        [[2401, 2214, 2081, 5, 33], 0.37],
        [[3026, 2833, 2622, 5, 38], 0.35],
        [[3812, 3627, 3304, 7, 45], 0.33],
        [[4804, 4642, 4163, 8, 53], 0.31],
        [[6053, 5942, 5246, 9, 62], 0.29],
        [[7626, 7606, 6609, 10, 72], 0.28]
    ],
    [
        [[15000, 25000, 10000, 80, 80], 0.63],
        [[30000, 50000, 20000, 14, 94], 0.59],
        [[60000, 100000, 40000, 16, 110], 0.56]
    ],
    [
        [[220, 180, 240, 20, 20], 0.91],
        [[277, 230, 302, 3, 23], 0.83],
        [[349, 293, 381, 4, 27], 0.75],
        [[440, 373, 480, 5, 32], 0.68],
        [[555, 476, 605, 5, 37], 0.62],
        [[699, 606, 762, 7, 44], 0.56],
        [[880, 773, 960, 7, 51], 0.51],
        [[1109, 986, 1210, 9, 60], 0.47],
        [[1398, 1257, 1525, 10, 70], 0.42],
        [[1761, 1603, 1921, 12, 82], 0.39],
        [[2219, 2043, 2421, 14, 96], 0.35],
        [[2796, 2605, 3050, 16, 112], 0.32],
        [[3523, 3322, 3843, 20, 132], 0.29],
        [[4439, 4236, 4842, 22, 154], 0.26],
        [[5593, 5400, 6101, 26, 180], 0.24],
        [[7047, 6885, 7687, 31, 211], 0.22],
        [[8879, 8779, 9686, 36, 247], 0.2],
        [[11187, 11193, 12204, 42, 289], 0.18],
        [[14096, 14271, 15377, 49, 338], 0.16],
        [[17761, 18196, 19375, 57, 395], 0.15]
    ],
    [
        [[10, 40, 30, 0, 0], 1.0]
    ],
    [
        [[220, 220, 220, 10, 10], 1.0]
    ],
    [
        [[100, 100, 100, 20, 20], 1],
        [[126, 128, 126, 3, 23], 2],
        [[159, 163, 159, 4, 27], 3],
        [[200, 207, 200, 5, 32], 4],
        [[252, 264, 252, 5, 37], 5],
        [[318, 337, 318, 7, 44], 6],
        [[400, 430, 400, 7, 51], 7],
        [[504, 548, 504, 9, 60], 8],
        [[635, 698, 635, 10, 70], 9],
        [[800, 890, 800, 12, 82], 10],
        [[1009, 1135, 1009, 14, 96], 11],
        [[1271, 1447, 1271, 16, 112], 14],
        [[1601, 1846, 1601, 20, 132], 19],
        [[2018, 2353, 2018, 22, 154], 26],
        [[2542, 3000, 2542, 26, 180], 35],
        [[3203, 3825, 3203, 31, 211], 46],
        [[4036, 4877, 4036, 36, 247], 59],
        [[5085, 6218, 5085, 42, 289], 74],
        [[6407, 7928, 6407, 49, 338], 91],
        [[8073, 10109, 8073, 57, 395], 110],
        [[10172, 12889, 10172, 67, 462], 131],
        [[12817, 16433, 12817, 79, 541], 154],
        [[16149, 20952, 16149, 92, 633], 179],
        [[20348, 26714, 20348, 107, 740], 206],
        [[25639, 34060, 25639, 126, 866], 235]
    ],
    [
        [[50, 60, 40, 5, 5], 30],
        [[63, 77, 50, 1, 6], 35],
        [[78, 98, 62, 1, 7], 41],
        [[98, 124, 77, 1, 8], 47],
        [[122, 159, 96, 1, 9], 55],
        [[153, 202, 120, 1, 10], 64],
        [[191, 258, 149, 2, 12], 74],
        [[238, 329, 185, 2, 14], 86],
        [[298, 419, 231, 2, 16], 100],
        [[373, 534, 287, 2, 18], 117],
        [[466, 681, 358, 3, 21], 136],
        [[582, 868, 446, 3, 24], 158],
        [[728, 1107, 555, 4, 28], 184],
        [[909, 1412, 691, 5, 33], 214],
        [[1137, 1800, 860, 5, 38], 249],
        [[1421, 2295, 1071, 5, 43], 289],
        [[1776, 2926, 1333, 7, 50], 337],
        [[2220, 3731, 1659, 8, 58], 391],
        [[2776, 4757, 2066, 9, 67], 455],
        [[3469, 6065, 2572, 10, 77], 530],
        [[4337, 7733, 3202, 12, 89], 616],
        [[5421, 9860, 3987, 14, 103], 717],
        [[6776, 12571, 4963, 16, 119], 833],
        [[8470, 16028, 6180, 19, 138], 969],
        [[10588, 20436, 7694, 21, 159], 1127],
        [[13235, 26056, 9578, 24, 183], 1311],
        [[16544, 33221, 11925, 29, 212], 1525],
        [[20680, 42357, 14847, 33, 245], 1774],
        [[25849, 54005, 18484, 38, 283], 2063],
        [[32312, 68857, 23013, 43, 326], 2400]
    ],
    [
        [[65, 50, 40, 10, 10], 30],
        [[83, 63, 50, 1, 11], 35],
        [[105, 80, 62, 2, 13], 41],
        [[133, 101, 76, 2, 15], 47],
        [[169, 128, 95, 2, 17], 55],
        [[215, 162, 117, 2, 19], 64],
        [[273, 205, 145, 3, 22], 74],
        [[346, 259, 180, 3, 25], 86],
        [[440, 328, 224, 4, 29], 100],
        [[559, 415, 277, 4, 33], 117],
        [[709, 525, 344, 4, 37], 136],
        [[901, 664, 426, 5, 42], 158],
        [[1144, 840, 529, 6, 48], 184],
        [[1453, 1062, 655, 7, 55], 214],
        [[1846, 1343, 813, 8, 63], 249],
        [[2344, 1700, 1008, 8, 71], 289],
        [[2977, 2150, 1250, 10, 81], 337],
        [[3781, 2720, 1550, 12, 93], 391],
        [[4802, 3440, 1922, 13, 106], 455],
        [[6098, 4352, 2383, 15, 121], 530],
        [[7744, 5505, 2955, 16, 137], 616],
        [[9835, 6964, 3664, 20, 157], 717],
        [[12491, 8810, 4543, 22, 179], 833],
        [[15863, 11144, 5633, 25, 204], 969],
        [[20147, 14098, 6985, 28, 232], 1127],
        [[25586, 17833, 8662, 33, 265], 1311],
        [[32495, 22559, 10740, 37, 302], 1525],
        [[41268, 28537, 13318, 42, 344], 1774],
        [[52410, 36100, 16515, 48, 392], 2063],
        [[66561, 45666, 20478, 55, 447], 2400]
    ],
    [
        [[75, 65, 70, 10, 10], 30],
        [[94, 83, 87, 2, 12], 35],
        [[118, 106, 108, 2, 14], 41],
        [[147, 135, 133, 2, 16], 47],
        [[184, 172, 165, 3, 19], 55],
        [[231, 219, 205, 3, 22], 64],
        [[289, 279, 254, 4, 26], 74],
        [[362, 356, 316, 4, 30], 86],
        [[453, 454, 391, 5, 35], 100],
        [[567, 579, 485, 6, 41], 117],
        [[710, 738, 602, 7, 48], 136],
        [[889, 941, 746, 8, 56], 158],
        [[1113, 1200, 925, 10, 66], 184],
        [[1393, 1529, 1147, 11, 77], 214],
        [[1744, 1950, 1422, 13, 90], 249],
        [[2183, 2486, 1764, 15, 105], 289],
        [[2734, 3170, 2187, 18, 123], 337],
        [[3422, 4042, 2712, 21, 144], 391],
        [[4285, 5153, 3363, 25, 169], 455],
        [[5365, 6571, 4170, 28, 197], 530],
        [[6717, 8378, 5170, 34, 231], 616],
        [[8409, 10681, 6411, 39, 270], 717],
        [[10528, 13619, 7950, 46, 316], 833],
        [[13181, 17364, 9858, 54, 370], 969],
        [[16503, 22139, 12224, 63, 433], 1127],
        [[20662, 28227, 15158, 74, 507], 1311],
        [[25869, 35990, 18796, 86, 593], 1525],
        [[32388, 45887, 23307, 100, 693], 1774],
        [[40549, 58506, 28900, 118, 811], 2063],
        [[50768, 74595, 35837, 138, 949], 2400]
    ],
    [
        [[45, 40, 30, 0, 0], 240],
        [[59, 53, 39, 0, 0], 281],
        [[76, 70, 50, 0, 0], 329],
        [[99, 92, 64, 0, 0], 386],
        [[129, 121, 83, 0, 0], 452],
        [[167, 160, 107, 0, 0], 530],
        [[217, 212, 138, 0, 0], 622],
        [[282, 279, 178, 0, 0], 729],
        [[367, 369, 230, 0, 0], 854],
        [[477, 487, 297, 0, 0], 1002],
        [[620, 642, 383, 0, 0], 1174],
        [[806, 848, 494, 0, 0], 1376],
        [[1048, 1119, 637, 0, 0], 1613],
        [[1363, 1477, 822, 0, 0], 1891],
        [[1772, 1950, 1060, 0, 0], 2216],
        [[2303, 2574, 1368, 0, 0], 2598],
        [[2994, 3398, 1764, 0, 0], 3045],
        [[3893, 4486, 2276, 0, 0], 3569],
        [[5060, 5921, 2936, 0, 0], 4183],
        [[6579, 7816, 3787, 0, 0], 4904],
        [[8552, 10317, 4886, 0, 0], 5748],
        [[11118, 13618, 6302, 0, 0], 6737],
        [[14453, 17976, 8130, 0, 0], 7896],
        [[18789, 23728, 10488, 0, 0], 9255],
        [[24426, 31321, 13529, 0, 0], 10848],
        [[31754, 41344, 17453, 0, 0], 12715],
        [[41280, 54574, 22514, 0, 0], 14904],
        [[53664, 72037, 29043, 0, 0], 17469],
        [[69763, 95089, 37466, 0, 0], 20476],
        [[90692, 125517, 48331, 0, 0], 24000]
    ],
    [
        [[60, 50, 40, 0, 0], 1000],
        [[76, 64, 50, 0, 0], 1229],
        [[96, 81, 62, 0, 0], 1512],
        [[121, 102, 77, 0, 0], 1859],
        [[154, 130, 96, 0, 0], 2285],
        [[194, 165, 120, 0, 0], 2810],
        [[246, 210, 149, 0, 0], 3454],
        [[311, 266, 185, 0, 0], 4247],
        [[393, 338, 231, 0, 0], 5222],
        [[498, 430, 287, 0, 0], 6420],
        [[630, 546, 358, 0, 0], 7893],
        [[796, 693, 446, 0, 0], 9705],
        [[1007, 880, 555, 0, 0], 11932],
        [[1274, 1118, 691, 0, 0], 14670],
        [[1612, 1420, 860, 0, 0], 18037],
        [[2039, 1803, 1071, 0, 0], 22177],
        [[2580, 2290, 1333, 0, 0], 27266],
        [[3264, 2908, 1659, 0, 0], 33523],
        [[4128, 3693, 2066, 0, 0], 41217],
        [[5222, 4691, 2572, 0, 0], 50675],
        [[6606, 5957, 3202, 0, 0], 62305],
        [[8357, 7566, 3987, 0, 0], 76604],
        [[10572, 9608, 4963, 0, 0], 94184],
        [[13373, 12203, 6180, 0, 0], 115798],
        [[16917, 15497, 7694, 0, 0], 142373],
        [[21400, 19682, 9578, 0, 0], 175047],
        [[27071, 24996, 11925, 0, 0], 215219],
        [[34245, 31745, 14847, 0, 0], 264611],
        [[43320, 40316, 18484, 0, 0], 325337],
        [[54799, 51201, 23013, 0, 0], 400000]
    ],
    [
        [[50, 60, 50, 2, 2], 150],
        [[63, 75, 63, 0, 2], 200],
        [[78, 94, 78, 1, 3], 267],
        [[98, 117, 98, 0, 3], 356],
        [[122, 146, 122, 1, 4], 474],
        [[153, 183, 153, 0, 4], 632],
        [[191, 229, 191, 1, 5], 843],
        [[238, 286, 238, 1, 6], 1125],
        [[298, 358, 298, 1, 7], 1500],
        [[373, 447, 373, 1, 8], 2000]
    ],
    [
        [[50, 100, 20, 5, 5], 0.04],
        [[63, 128, 25, 1, 6], 0.08],
        [[79, 163, 32, 1, 7], 0.12],
        [[100, 207, 40, 1, 8], 0.16],
        [[126, 264, 50, 1, 9], 0.2],
        [[159, 337, 64, 2, 11], 0.24],
        [[200, 430, 80, 2, 13], 0.29],
        [[252, 548, 101, 2, 15], 0.34],
        [[318, 698, 127, 3, 18], 0.39],
        [[400, 890, 160, 3, 21], 0.44],
        [[504, 1135, 202, 3, 24], 0.49],
        [[635, 1447, 254, 4, 28], 0.55],
        [[801, 1846, 320, 5, 33], 0.6],
        [[1009, 2353, 404, 5, 38], 0.66],
        [[1271, 3000, 508, 7, 45], 0.72],
        [[1602, 3825, 641, 8, 53], 0.79],
        [[2018, 4877, 807, 9, 62], 0.85],
        [[2543, 6218, 1017, 10, 72], 0.92],
        [[3204, 7928, 1281, 12, 84], 0.99],
        [[4037, 10109, 1615, 15, 99], 1.07]
    ],
]

data = {
    "requirements": {},
    "levels": []
}


def create_files():
    for i, name in enumerate(buildings):
        f = open(f"{name}.json", "w")
        data["requirements"].clear()
        data["requirements"].update(requirements[i])
        data["levels"] = levels[i]
        f.write(json.dumps(data))
        f.close()


def json_parser_for_buildings():
    s = """[
  [1,"{{Res|50|100|20}}","{{Workers|5|5}}","4%"  ],
  [2,"{{Res|63|128|25}}","{{Workers|1|6}}","8%"  ],
  [3,"{{Res|79|163|32}}","{{Workers|1|7}}","12%"  ],
  [4,"{{Res|100|207|40}}","{{Workers|1|8}}","16%"  ],
  [5,"{{Res|126|264|50}}","{{Workers|1|9}}","20%"  ],
  [6,"{{Res|159|337|64}}","{{Workers|2|11}}","24%"  ],
  [7,"{{Res|200|430|80}}","{{Workers|2|13}}","29%"  ],
  [8,"{{Res|252|548|101}}","{{Workers|2|15}}","34%"  ],
  [9,"{{Res|318|698|127}}","{{Workers|3|18}}","39%"  ],
  [10,"{{Res|400|890|160}}","{{Workers|3|21}}","44%"  ],
  [11,"{{Res|504|1135|202}}","{{Workers|3|24}}","49%"  ],
  [12,"{{Res|635|1447|254}}","{{Workers|4|28}}","55%"  ],
  [13,"{{Res|801|1846|320}}","{{Workers|5|33}}","60%"  ],
  [14,"{{Res|1009|2353|404}}","{{Workers|5|38}}","66%"  ],
  [15,"{{Res|1271|3000|508}}","{{Workers|7|45}}","72%"  ],
  [16,"{{Res|1602|3825|641}}","{{Workers|8|53}}","79%"  ],
  [17,"{{Res|2018|4877|807}}","{{Workers|9|62}}","85%"  ],
  [18,"{{Res|2543|6218|1017}}","{{Workers|10|72}}","92%"  ],
  [19,"{{Res|3204|7928|1281}}","{{Workers|12|84}}","99%"  ],
  [20,"{{Res|4037|10109|1615}}","{{Workers|15|99}}","107%"  ]
]"""
    json_object = json.loads(s)
    result = ""
    for index, element in enumerate(json_object):
        wood, clay, iron = str(element[1][6:-2]).split("|")
        pop = str(element[2][10:-2]).split("|")[0]
        factor = float(element[3][0:-1]) / 100
        print(f"[[{wood},{clay},{iron},{pop}], {factor}],")


def json_parser_for_points():
    s = """[
  ["1,10,16,20,24,10,10,42,512,19,0,24,10,6,6,6,5,6,5,8","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["2,2,3,4,5,2,,8,,4,,,2,1,1,1,1,1,1,2","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["3,2,4,5,6,2,,10,,4,,,2,2,2,2,1,2,1,2","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["4,3,5,6,6,,,13,,6,,,3,1,1,1,2,1,2,2","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["5,4,5,6,9,,,14,,6,,,4,2,2,2,1,2,1,3","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["6,4,7,9,10,,,18,,8,,,4,3,3,3,2,3,2,3","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["7,5,8,10,12,,,20,,10,,,5,3,3,3,3,3,3,4","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["8,6,9,12,14,,,25,,11,,,6,3,3,3,3,3,3,5","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["9,7,12,14,17,,,31,,14,,,7,5,5,5,3,5,3,5","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["10,9,14,17,21,,,36,,16,,,9,5,5,5,5,5,5,7","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["11,10,16,21,25,,,43,,20,,,10,6,6,6,5,6,,9","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["12,12,20,25,29,,,52,,23,,,12,8,8,8,6,8,,9","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["13,15,24,29,36,,,62,,28,,,15,8,8,8,8,8,,12","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["14,18,28,36,43,,,75,,34,,,18,11,11,11,8,11,,15","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["15,21,34,43,51,,,90,,41,,,21,13,13,13,11,13,,17","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["16,26,42,51,,,,108,,49,,,26,15,15,15,13,15,,20","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["17,31,49,62,,,,130,,58,,,31,19,19,19,15,19,,25","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["18,37,59,74,,,,155,,71,,,37,22,22,22,19,22,,29","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["19,44,71,88,,,,186,,84,,,44,27,27,27,22,27,,36","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["20,53,85,107,,,,224,,101,,,53,32,32,32,27,32,,43","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["21,64,102,,,,,,,,,,64,38,38,38,32,38,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["22,77,123,,,,,,,,,,77,46,46,46,38,46,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["23,92,147,,,,,,,,,,92,55,55,55,46,55,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["24,110,177,,,,,,,,,,110,66,66,66,55,66,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["25,133,212,,,,,,,,,,133,80,80,80,66,80,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["26,159,,,,,,,,,,,,95,95,95,80,95,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["27,191,,,,,,,,,,,,115,115,115,95,115,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["28,229,,,,,,,,,,,,137,137,137,115,137,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["29,274,,,,,,,,,,,,165,165,165,137,165,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],
  ["30,330,,,,,,,,,,,,198,198,198,165,198,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ]
]"""
    json_object = json.loads(s)
    matrix = [[0 for x in range(30)] for y in range(16)]
    y = 0
    x = 0
    for index_y, element_y in enumerate(json_object):
        l = str(element_y[0][1:]).split("'")[0].split(",")
        for index_x, element_x in enumerate(l):
            if index_x == 0 or 5 <= index_x <= 7:
                continue

            matrix[y][x] = 0 if element_x == '' else int(element_x)
            y += 1

        x += 1
        y = 0

    f = open(f"POINTS.json", "w")
    f.write(json.dumps(matrix))
    f.close()

# create_files()
# json_parser_for_buildings()
# json_parser_for_points()
[   [1,"{{Res|50|100|20}}","{{Workers|5|5}}","4%"  ],   [2,"{{Res|63|128|25}}","{{Workers|1|6}}","8%"  ],   [3,"{{Res|79|163|32}}","{{Workers|1|7}}","12%"  ],   [4,"{{Res|100|207|40}}","{{Workers|1|8}}","16%"  ],   [5,"{{Res|126|264|50}}","{{Workers|1|9}}","20%"  ],   [6,"{{Res|159|337|64}}","{{Workers|2|11}}","24%"  ],   [7,"{{Res|200|430|80}}","{{Workers|2|13}}","29%"  ],   [8,"{{Res|252|548|101}}","{{Workers|2|15}}","34%"  ],   [9,"{{Res|318|698|127}}","{{Workers|3|18}}","39%"  ],   [10,"{{Res|400|890|160}}","{{Workers|3|21}}","44%"  ],   [11,"{{Res|504|1135|202}}","{{Workers|3|24}}","49%"  ],   [12,"{{Res|635|1447|254}}","{{Workers|4|28}}","55%"  ],   [13,"{{Res|801|1846|320}}","{{Workers|5|33}}","60%"  ],   [14,"{{Res|1009|2353|404}}","{{Workers|5|38}}","66%"  ],   [15,"{{Res|1271|3000|508}}","{{Workers|7|45}}","72%"  ],   [16,"{{Res|1602|3825|641}}","{{Workers|8|53}}","79%"  ],   [17,"{{Res|2018|4877|807}}","{{Workers|9|62}}","85%"  ],   [18,"{{Res|2543|6218|1017}}","{{Workers|10|72}}","92%"  ],   [19,"{{Res|3204|7928|1281}}","{{Workers|12|84}}","99%"  ],   [20,"{{Res|4037|10109|1615}}","{{Workers|15|99}}","107%"  ] ] [   ["1,10,16,20,24,10,10,42,512,19,0,24,10,6,6,6,5,6,5,8","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["2,2,3,4,5,2,,8,,4,,,2,1,1,1,1,1,1,2","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["3,2,4,5,6,2,,10,,4,,,2,2,2,2,1,2,1,2","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["4,3,5,6,6,,,13,,6,,,3,1,1,1,2,1,2,2","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["5,4,5,6,9,,,14,,6,,,4,2,2,2,1,2,1,3","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["6,4,7,9,10,,,18,,8,,,4,3,3,3,2,3,2,3","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["7,5,8,10,12,,,20,,10,,,5,3,3,3,3,3,3,4","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["8,6,9,12,14,,,25,,11,,,6,3,3,3,3,3,3,5","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["9,7,12,14,17,,,31,,14,,,7,5,5,5,3,5,3,5","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["10,9,14,17,21,,,36,,16,,,9,5,5,5,5,5,5,7","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["11,10,16,21,25,,,43,,20,,,10,6,6,6,5,6,,9","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["12,12,20,25,29,,,52,,23,,,12,8,8,8,6,8,,9","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["13,15,24,29,36,,,62,,28,,,15,8,8,8,8,8,,12","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["14,18,28,36,43,,,75,,34,,,18,11,11,11,8,11,,15","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["15,21,34,43,51,,,90,,41,,,21,13,13,13,11,13,,17","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["16,26,42,51,,,,108,,49,,,26,15,15,15,13,15,,20","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["17,31,49,62,,,,130,,58,,,31,19,19,19,15,19,,25","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["18,37,59,74,,,,155,,71,,,37,22,22,22,19,22,,29","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["19,44,71,88,,,,186,,84,,,44,27,27,27,22,27,,36","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["20,53,85,107,,,,224,,101,,,53,32,32,32,27,32,,43","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["21,64,102,,,,,,,,,,64,38,38,38,32,38,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["22,77,123,,,,,,,,,,77,46,46,46,38,46,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["23,92,147,,,,,,,,,,92,55,55,55,46,55,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["24,110,177,,,,,,,,,,110,66,66,66,55,66,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["25,133,212,,,,,,,,,,133,80,80,80,66,80,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["26,159,,,,,,,,,,,,95,95,95,80,95,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["27,191,,,,,,,,,,,,115,115,115,95,115,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["28,229,,,,,,,,,,,,137,137,137,115,137,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["29,274,,,,,,,,,,,,165,165,165,137,165,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ],   ["30,330,,,,,,,,,,,,198,198,198,165,198,,","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""  ] ] # create_files() # json_parser_for_buildings() # json_parser_for_points()