let fs = require('fs');
const pergen = 9;
var foods = JSON.parse(fs.readFileSync('allfoods.json', 'utf-8')).foods;

//map of food string to texture(path)
var compositeData = [];
var group = 0;
var iter = 0;
compositeData[group] = {};
foods.forEach((ele,idx,arr) => {
    let splitstr = ele.split(":");
    let path = "assets/" + splitstr[0] + "/textures/item/" + splitstr[1] + ".png";
    compositeData[group][ele] = path;
    iter++;
    if (iter == pergen) {
        iter = 0;
        group++;
        compositeData[group] = {};
    }
});

fs.writeFileSync("generated/0.json", JSON.stringify(compositeData));