Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solver extends Memoize {
- recipes: Map<Item, Recipe>;
- implementation(target: Item){
- var output = new Map;
- var ore = 0;
- const recipe = this.recipes.get(target)!;
- for(const input of recipe.inputs){
- const result = this(input.item);
- output += result.output * input.amount;
- ore += result.ore * input.amount;
- }
- return {
- output: output,
- ore: ore,
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement