Skip to content

Instantly share code, notes, and snippets.

View nickponline's full-sized avatar
🐙
Computers

Nicholas Pilkington nickponline

🐙
Computers
View GitHub Profile
# https://adventofcode.com/2024/day/22
def step(secret):
secret ^= (secret << 0x6) & 0xFFFFFF
secret ^= (secret >> 0x5) & 0xFFFFFF
secret ^= (secret << 0xB) & 0xFFFFFF
return secret
def steps(secret, k=2000):
for _ in range(k):
secret = step(secret)
# https://adventofcode.com/2024/day/23
import networkx as nx, re
graph = nx.Graph()
with open('2024-23.in') as f:
graph.add_edges_from([(source, target) for source, target in re.findall(r'(\w+)-(\w+)', f.read())])
cliques = list(nx.enumerate_all_cliques(graph))