day14 package
Subpackages
Submodules
day14.day14 module
day14 solution.
- class day14.day14.World(data: Any, left_is: Direction = Direction.West, score: int | None = None)[source]
Bases:
object
2d array of boulders (square/round) and empty space.
- data: Any
- score: int | None = None
- day14.day14.naive_score(world_rows: list[str]) int [source]
Returns score assuming west is pointing left.
For each row, a round boulder
O
’s score isnum_rows
minus itsindex
(higher weight to the left.)
- day14.day14.question1(world: World) int [source]
Returns world’s score after rotating the world once.
- day14.day14.question2(world: World) int [source]
Finds a loop in world rotation.
Once the loop is found we can estimate the world’s state after any amount of rotations
- Parameters:
world (World) – world to spin
- Returns:
“weight” to the north after 1000000000 cycles.
- Return type:
int
Module contents
Day14 Solution.