Skip to content

Commit

Permalink
Merge pull request #15 from dieseltravis/glitch
Browse files Browse the repository at this point in the history
🍳🏸 Updated with Glitch: day 5 part 2 was off by 1
  • Loading branch information
dieseltravis authored Dec 7, 2023
2 parents 43a49ec + d3ce331 commit 0073425
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "branch-three-oviraptor",
"version": "2023.12.04",
"version": "2023.12.06",
"description": "Travis's Advent of Code 2023",
"author": "Travis Hardiman",
"homepage": "https://branch-three-oviraptor.glitch.me/",
Expand Down
9 changes: 2 additions & 7 deletions public/funs.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
const nums = l.split(' ').map(Number);
return {
sourceStart: nums[1],
sourceEnd: nums[1] + nums[2],
sourceEnd: nums[1] + nums[2] - 1,
dest: nums[0]
};
});
Expand All @@ -371,7 +371,7 @@
const seedEnd = seedStart + seedRange;
console.log(++seedGroup, seedStart, seedRange, seedEnd);

for (let seed = seedStart; seed <= seedEnd; seed++) {
for (let seed = seedStart; seed < seedEnd; seed++) {
const last = routes.reduce((seedPos, routeList) => {
const newRoute = routeList.find(route => seedPos >= route.sourceStart && seedPos <= route.sourceEnd);
const newPos = newRoute ? (seedPos - newRoute.sourceStart) + newRoute.dest : seedPos;
Expand All @@ -383,11 +383,6 @@
});

console.log(smallest);
// 28580590
// 28580590
// 28580590
// 28580590 is too high
// 240320250 is too high
return smallest;
}
},
Expand Down

0 comments on commit 0073425

Please sign in to comment.