Skip to content

Commit

Permalink
Update data, 10,000
Browse files Browse the repository at this point in the history
  • Loading branch information
expitau committed Feb 17, 2024
1 parent ed8272d commit 7544dde
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion data.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Infinite Craft Wiki</title>
<meta name="description" content="Explore over 3500 crafting recipes from Infinite Craft!">
<meta name="description" content="Explore over 10,000 crafting recipes from Infinite Craft!">
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-PCW5J4G9KX"></script>
<script>
Expand Down
11 changes: 7 additions & 4 deletions infiniteCraft.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ async function craft(a, b) {
}

function alreadyChecked(attempted, elementA, elementB) {
if (elementA == elementB) {
return attempted.some(x => x.elements.includes(elementA) && x.elements.includes(elementB) && x.elements[0] == x.elements[1])
}
return attempted.some(x => x.elements.includes(elementA) && x.elements.includes(elementB))
}

Expand Down Expand Up @@ -119,17 +122,17 @@ async function getElements() {
// let [elementA, elementB] = getSpecificPair(attempted, costs, "Dragon")
let response = await craft(elementA, elementB)
if (response.result == "Nothing") {
console.log(`${elementA} + ${elementB} -> ${response.result} (not added)`)
console.log(`${i}: ${elementA} + ${elementB} -> ${response.result} (not added)`)
attempted.push({ elements: [elementA, elementB], result: response.result })
} else if (Object.keys(costs).includes(response.result)) {
console.log(`${elementA} + ${elementB} -> ${response.result}`)
console.log(`${i}: ${elementA} + ${elementB} -> ${response.result}`)
attempted.push({ elements: [elementA, elementB], result: response.result })
if (costs[response.result] > costs[elementA] + costs[elementB]) {
console.log(`Reduced cost for ${response.result} from ${costs[response.result]} to ${costs[elementA] + costs[elementB]}`)
// console.log(`Reduced cost for ${response.result} from ${costs[response.result]} to ${costs[elementA] + costs[elementB]}`)
costs[response.result] = costs[elementA] + costs[elementB]
}
} else {
console.log(`${elementA} + ${elementB} -> ${response.result} (new element)`)
console.log(`${i}: ${elementA} + ${elementB} -> ${response.result} (new element)`)
attempted.push({ elements: [elementA, elementB], result: response.result })
costs[response.result] = costs[elementA] + costs[elementB]
icons[response.result] = response.emoji
Expand Down

0 comments on commit 7544dde

Please sign in to comment.