Module day15

Source
Expand description

ยงDueling Generators

Multithreaded approach using worker threads to generate batches of numbers for judging. Part one can be checked in parallel, but part two must be sent to a single thread as the indices must be checked in order.

The sequence of numbers are modular exponentiation so we can jump to any location in the sequence, without needing to know the previous numbers.

Structsยง

Block ๐Ÿ”’
Generated numbers from start to start + BLOCK.
Shared
State shared between all threads.

Constantsยง

BLOCK ๐Ÿ”’
PART_ONE ๐Ÿ”’
PART_TWO ๐Ÿ”’

Functionsยง

parse
part1
part2
receiver ๐Ÿ”’
sender ๐Ÿ”’

Type Aliasesยง

Input ๐Ÿ”’