Skip to content

Commit

Permalink
Update advent of code to not use reduce_add.
Browse files Browse the repository at this point in the history
  • Loading branch information
lerno committed Dec 14, 2022
1 parent a724019 commit 6b22f24
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions day14.c3
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn Environment* load_environment(EnvType type)
continue;
}
int[<2>] diff = { math::sign(next[0] - last[0]), math::sign(next[1] - last[1]) };
while (!$$reduce_and(last == next))
while (last != next)
{
last += diff;
env[last[0]][last[1]] = -1;
Expand Down Expand Up @@ -81,7 +81,7 @@ fn Result simulate_sand_path(Environment* env, int[<2>] sand)
case (!env[sand[0] + 1][sand[1] + 1]):
sand += { 1 , 1 };
default:
if ($$reduce_and(start == sand)) return SAND_CHOKED;
if (start == sand) return SAND_CHOKED;
env[sand[0]][sand[1]] = 1;
return CAME_TO_REST;
}
Expand Down

0 comments on commit 6b22f24

Please sign in to comment.