1

I have an object full of blueprints. The blueprint is an array of either another blueprint or and ingredient. I'm trying to show a path to build a 'Stasis Device' but the output is missing some steps. The output displays:

["Heat Capacitor",["Frost Crystal","Solanium"]]
["Poly Fibre",["Cactus Flesh","Star Bulb"]]
["Circuit Board",["Heat Capacitor","Poly Fibre"]]
-- missing output. see below --
["Quantum Processor",["Circuit Board","Superconductor"]]
["Lubricant",["Faecium","Gamma Root"]]
["Glass",["Frost Crystal"]]
["Living Glass",["Lubricant","Glass"]]
["Enriched Carbon",["Radon","Condensed Carbon"]]
["Nitrogen Salt",["Nitrogen","Condensed Carbon"]]
["Hot Ice",["Enriched Carbon","Nitrogen Salt"]]
-- missing output. see below --
["Cryo-Pump",["Hot Ice","Thermic Condensate"]]
["Cryogenic Chamber",["Living Glass","Cryo-Pump"]]
["Aronium",["Paraffinium","Ionised Cobalt"]]
["Mango-Gold",["Phosphorus","Ionised Cobalt"]]
["Grantine",["Dioxite","Ionised Cobalt"]]
["Iridesite",["Aronium","Mango-Gold","Grantine"]]
["Stasis Device",["Quantum Processor","Cryogenic Chamber","Iridesite"]]

before "Quantum Processor" I expected

["Termic Condensate",["Sulphurine","Condensed Carbon"]
["Nitrogen Salt",["Nitrogen","Condensed Carbon"]]
["Semiconductor",["Thermic Condensate","Nitrogen Salt"]]
["Enriched Carbon",["Radon","Condensed Carbon"]]
["Super Conductor",["Semiconductor","Enriched Carbon"]]

and before "Cryo-Pump" I expected

["Termic Condensate",["Sulphurine","Condensed Carbon"]

The code follows and is also in a jsFiddle https://jsfiddle.net/shirha/7azgyu36/48/

<pre id="log"></pre><script>

const db = Object.create(null);
db.Valuables = JSON.parse(`{
"Aronium": ["Paraffinium","Ionised Cobalt"],
"Circuit Board": ["Heat Capacitor","Poly Fibre"],
"Cryo-Pump": ["Hot Ice","Thermic Condensate"],
"Cryogenic Chamber": ["Living Glass","Cryo-Pump"],
"Enriched Carbon": ["Radon","Condensed Carbon"],
"Glass": ["Frost Crystal"],
"Grantine": ["Dioxite","Ionised Cobalt"],
"Heat Capacitor": ["Frost Crystal","Solanium"],
"Hot Ice": ["Enriched Carbon","Nitrogen Salt"],
"Iridesite": ["Aronium","Mango-Gold","Grantine"],
"Living Glass": ["Lubricant","Glass"],
"Lubricant": ["Faecium","Gamma Root"],
"Mango-Gold": ["Phosphorus","Ionised Cobalt"],
"Nitrogen Salt": ["Nitrogen","Condensed Carbon"],
"Poly Fibre": ["Cactus Flesh","Star Bulb"],
"Quantum Processor": ["Circuit Board","Superconductor"],
"Semiconductor": ["Thermic Condensate","Nitrogen Salt"],
"Stasis Device": ["Quantum Processor","Cryogenic Chamber","Iridesite"],
"Super Conductor": ["Semiconductor","Enriched Carbon"],
"Termic Condensate": ["Sulphurine","Condensed Carbon"]
}`);

function analyse(recipe){
  let blueprint = db.Valuables[recipe];
  for(let i = 0; i < blueprint.length; i++){
    if(blueprint[i] in db.Valuables){
      analyse(blueprint[i]);
    }
  }
  log.innerHTML += JSON.stringify([recipe,blueprint])+"<br>";
}

log = document.getElementById('log');
analyse("Stasis Device");
</script>

This is as close as I can get it without making it worse. Thanks for any help.

jsFiddle has been corrected! Thanks to all.

1
  • 2
    "Superconductor" and "Super Conductor" are not the same thing. Commented Aug 24, 2021 at 21:44

1 Answer 1

3

There are a couple of misspellings:

  • Super Conductor → Superconductor
  • Termic Condensate → Thermic Condensate
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.