use mod operator

This commit is contained in:
Adam Millerchip 2022-08-14 00:46:10 +09:00
parent 9a81f47677
commit 280e6fcf2b

View file

@ -39,7 +39,7 @@ fn count_trees(slope: [][]bool, delta_x: usize, delta_y: usize) usize {
if (square) {
count += 1;
}
x = std.math.mod(usize, x + delta_x, slope[y].len) catch 0;
x = (x + delta_x) % slope[y].len;
y += delta_y;
}
return count;