Skip to content

Commit bf28b80

Browse files
feat(2018 day-14): eliminate the need to define elves when creating recipes
moves elves to be a property of recipes so a list of elves doesn't have to be manually defined Breaks calculateXAfterY(x, y, elves), use calculateXAfterY(x, y) instead Breaks findPattern('XXX', recipes, elves), use findPattern('XXX', recipes) instead Breakds loopRecipesForElves(elves, recipes, X), use loopRecipesForElves(recipes, 15) instead
1 parent b008964 commit bf28b80

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

2018/day-14/solution.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@ const {
66

77
const input = 540561
88

9-
let elves = [3, 7]
10-
let recipes = new Recipes(elves)
11-
elves[0] = recipes.tail
12-
elves[1] = recipes.head
9+
let recipes = new Recipes([3, 7])
1310

14-
const answer = calculateXAfterY(10, input, recipes, elves)
11+
const answer = calculateXAfterY(10, input, recipes)
1512

1613
console.log(`-- Part 1 --`)
1714
console.log(`Answer: ${answer}`)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy