Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
shahata committed Dec 19, 2023
1 parent d788b9d commit 9ac42ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/2023/day19.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function run2(ranges, workflows, start = 'in') {
for (const rule of workflows[start].rules) {
const { operator, key, value } = rule.condition;
const next = JSON.parse(JSON.stringify(ranges));
if (operator && ranges[key].min < value && value < ranges[key].max) {
if (operator && ranges[key].min < value && ranges[key].max > value) {
if (operator === '<') next[key].max = (ranges[key].min = value) - 1;
else if (operator === '>') next[key].min = (ranges[key].max = value) + 1;
}
Expand Down

0 comments on commit 9ac42ca

Please sign in to comment.