Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Any chance of JSON recipe manifest?

Tangential: does anyone know a good (preferably open) dataset of crafting recipes to use for game mechanics?



You can download these files:

- resources: https://littlealchemy.com/resources/base.560.json

- names: https://littlealchemy.com/resources/en/names.560.json

Then you can run this Python code to extract/merge into one single file:

  import json

  with open('res.json', 'r') as f, open('names.json', 'r') as ff:
      res = json.load(f)
      names = json.load(ff)

  for res_id, res_name in names.iteritems():
      print("%s:" % res_name)
      for id1, id2 in res[str(res_id)].get('parents', []):
          print("\t %s + %s" % (names[str(id1)], names[str(id2)]))

Expected output:

  glacier:
  	 ice + mountain
  cart:
  	 wheel + wood
  nerd:
  	 human + glasses
  doctor:
  	 human + hospital
  wagon:
  	 cart + horse
  newspaper:
  	 paper + paper
  paper:
  	 wood + pressure


I wanted to see it in graph form, so a wrote I did pretty much the same but printed a dot code and piped that into dot. It was a disaster: A huge, unreadable mess. Try yourself if you're feeling adventurous:

    import json
    
    with open('base.560.json') as f:
        base = json.load(f)
    
    with open('names.560.json') as f:
        names = json.load(f)
    
    print('digraph {')
    
    for elnum, name in names.items():
        print(f'e{elnum} [label="{name}"];')
    
    for elnum, body in base.items():
        for el1, el2 in body.get('parents', ()):
            print(f'e{el1} -> e{elnum};')
            print(f'e{el2} -> e{elnum};')
    
    print('}')

    # python3.6 code.py | dot -Tpng dot.png


Check out https://github.com/redfast00/element-alchemy-cheater. I reverse engineered a bunch of these element alchemy games and extracted the recipes.


I once had the idea of generating them on the fly using mechanical them. Unfortunately, the quality of results was so bad I had to abandon it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: