Advertisement
Guest User

Untitled

a guest
Dec 14th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class Solver extends Memoize {
  2. recipes: Map<Item, Recipe>;
  3.  
  4. implementation(target: Item){
  5. var output = new Map;
  6. var ore = 0;
  7.  
  8. const recipe = this.recipes.get(target)!;
  9. for(const input of recipe.inputs){
  10. const result = this(input.item);
  11. output += result.output * input.amount;
  12. ore += result.ore * input.amount;
  13. }
  14.  
  15. return {
  16. output: output,
  17. ore: ore,
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement