mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-09-04 05:13:04 +02:00
easier to understand
This commit is contained in:
parent
4804e91011
commit
78843c9a26
2 changed files with 13 additions and 2 deletions
|
@ -16,7 +16,6 @@ Object.keys(tasks).forEach(taskName => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract category from task name
|
|
||||||
const category = taskName.split('_variant_')[0];
|
const category = taskName.split('_variant_')[0];
|
||||||
counts[category] = (counts[category] || 0) + 1;
|
counts[category] = (counts[category] || 0) + 1;
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,11 +2,23 @@ import fs from 'fs';
|
||||||
import {proceduralGeneration} from "../../src/agent/construction_tasks.js";
|
import {proceduralGeneration} from "../../src/agent/construction_tasks.js";
|
||||||
|
|
||||||
function createInitialInventory(blueprint, agents) {
|
function createInitialInventory(blueprint, agents) {
|
||||||
|
/*
|
||||||
|
params:
|
||||||
|
- blueprint object
|
||||||
|
- number of agents (for inventory initialization)
|
||||||
|
|
||||||
|
logic of the function:
|
||||||
|
- loop matrix
|
||||||
|
- every time a new material is hit, put it in a different agents inventory
|
||||||
|
-
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
const inventories = {};
|
const inventories = {};
|
||||||
const materialCounts = {};
|
const materialCounts = {};
|
||||||
let currentAgent = 0;
|
let currentAgent = 0;
|
||||||
|
|
||||||
// Initialize agent inventories
|
// Initialize inventories
|
||||||
for (let i = 0; i < agents; i++) {
|
for (let i = 0; i < agents; i++) {
|
||||||
inventories[i] = {};
|
inventories[i] = {};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue