Skip to content

Commit

Permalink
[2024/22] p1 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
StarlitGhost committed Dec 23, 2024
1 parent ea04793 commit ed9ffc6
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 2 deletions.
Binary file added .aoc_tiles/tiles/2024/21.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .aoc_tiles/tiles/2024/22.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions 2024/22/example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1
10
100
2024
4 changes: 4 additions & 0 deletions 2024/22/example_p2
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1
2
3
2024
28 changes: 28 additions & 0 deletions 2024/22/script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from GhostyUtils import aoc


def prune(number: int) -> int:
return number % 16777216


def evolve(number: int, repeat: int = 1) -> int:
for r in range(repeat):
number ^= number * 64
number = prune(number)

number ^= number // 32
number = prune(number)

number ^= number * 2048
number = prune(number)

return number


def main():
inputs = list(map(int, aoc.read_lines()))
print(f"p1: {sum(evolve(i, 2000) for i in inputs)}")


if __name__ == "__main__":
main()
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ My solutions to the yearly Advents of Code

<!-- AOC TILES BEGIN -->
<h1 align="center">
Advent of Code - 199/490
Advent of Code - 200/496
</h1>
<h1 align="center">
2024 - 38 ⭐ - Python
2024 - 39 ⭐ - Python
</h1>
<a href="2024/1/script.py">
<img src=".aoc_tiles/tiles/2024/01.png" width="161px">
Expand Down Expand Up @@ -68,6 +68,12 @@ My solutions to the yearly Advents of Code
<a href="2024/20/script.py">
<img src=".aoc_tiles/tiles/2024/20.png" width="161px">
</a>
<a href="None">
<img src=".aoc_tiles/tiles/2024/21.png" width="161px">
</a>
<a href="2024/22/script.py">
<img src=".aoc_tiles/tiles/2024/22.png" width="161px">
</a>
<h1 align="center">
2023 - 47 ⭐ - Python
</h1>
Expand Down

0 comments on commit ed9ffc6

Please sign in to comment.