Module day04

Source
Expand description

For part one we search each vertical, horizontal and diagonal line individually. By using a u32 bitmask of ASCII values we can check in both directions efficiently at the same time.

For part two the difference of the ASCII values of “M” and “S” is 6. No other combination of letter has this value, so if both diagonals are a 6 then we have a match.

Functions§

parse
part1
part2
scan_line 🔒
Searches a horizontal, vertical or diagonal line in both directions at once.