-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexplore.lua
More file actions
110 lines (82 loc) · 2.11 KB
/
explore.lua
File metadata and controls
110 lines (82 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
local json = require "lib/json"
local Backpack = require "lib/backpack"
local util = require "lib/util"
local print, println, format = util.print, util.println, util.format
function get_recipes()
local h = io.open("resources/recipes.json")
local string = h:read("*all")
h:close()
local tbl = json.decode(string)
return tbl
end
function get_types()
local tbl = get_recipes()
print(#tbl)
local bp = Backpack()
for i,v in pairs(tbl) do
bp:add(v['type'])
end
bp:display()
end
function crafting_recipe_diffs()
local tbl = get_recipes()
local bp = Backpack()
local weird_ings = {}
for i,v in pairs(tbl) do
if v['type'] == 'crafting' then
for _, ing in pairs(v['ingredients']) do
local len = 0
local has_item = false
local has_tag = false
for item,name in pairs(ing) do
len = len + 1
if item == 'item' then
has_item = true
end
if item == 'tag' then
has_tag = true
end
end
if (len==1 and has_item or has_tag) or (len==0) then
else
weird_ings[v['outputDisplayName']] = v
end
end
end
end
print(util.len(weird_ings))
for k,v in pairs(weird_ings) do
print(k)
end
for k,v in pairs(weird_ings) do
print(k,v)
end
end
get_types()
--[[
local tbl = get_recipes()
local bp = Backpack()
for k,v in pairs(tbl) do
if v['outputDisplayName'] == "Allthemodium Solar Panel" then
print(v)
print()
print()
end
end
]]
-- return an iterate that goes through it sorted
--bp:sort(function(a,b) return a[2] < b[2] end)
-- see if making a sep dict of item display name is worth it
function is_display_name_dict_worth()
-- total recipe count
-- #tbl
-- total unique displayName to itemName count
local tbl = get_recipes()
local dn2in = {}
for i,v in pairs(tbl) do
dn2in[v['outputDisplayName']] = v['outputName']
end
println("#recipes: {} B vs #displayNames: {} B", #tbl*40, util.len(dn2in)*40)
end
-- want to see if ingredients are similar for all crafting
--is_display_name_dict_worth()