This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Advent of Code template by @MathisHammel | |
# TODO | |
# - Make a snapshot of the file when a submission is correct | |
# - Display the rank when submission is accepted | |
# - Utility function to rotate/flip a 2D array | |
# - Cycle length detector/extrapolator to make loops faster | |
# - Put examples in cache | |
# - Warning if DAY is not the current day |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame # pip install pygame-ce | |
import random | |
from pygame import gfxdraw | |
FPS = 60 | |
fpsClock = pygame.time.Clock() | |
WINDOW_WIDTH = 600 | |
WINDOW_HEIGHT = 800 | |
BOX_OFFSET_TOP = 100 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# License : do anything you want except NFTs (fuck NFTs) | |
from PIL import Image | |
BASE_FILENAME = 'hokusai.jpeg' # 'pxfuel.jpg' | |
SIZE = 10 #43.3 | |
SCAN_SIZE = 10 # 5 | |
FLOAT_PRECISION = 4 | |
hex_h = SIZE * (3 ** 0.5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Advent of Code template by @MathisHammel | |
import requests | |
from aoc_secrets import AOC_COOKIE # Put your session cookie in this variable | |
YEAR = '2022' | |
def get_input(day): | |
req = requests.get(f'https://adventofcode.com/{YEAR}/day/{day}/input', headers={'cookie':'session='+AOC_COOKIE}) | |
return req.text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import random | |
# Takes a dataset variable and returns a solution variable | |
def solve(dataset): | |
for contributor in dataset['contributors'].values(): | |
contributor['availableAt'] = 0 | |
# Since we levelup only in skillsByName, avoid discrepancies | |
del contributor['skills'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
participants = '''@the_duf_ | |
@driikolu | |
@Tashiqi | |
@PontyGuillaume | |
@MrAdrien79 | |
@Nicoverflow | |
@dourojp | |
@Durab_ | |
@Femtozer | |
@C_Papazian |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Advent of Code automation template - @MathisHammel | |
This template provides functions to download inputs and submit answers on AoC. | |
You need to paste your adventofcode.com session cookie below. | |
If you don't know how to get this cookie, here's a quick tutorial: | |
- Open your browser and go to adventofcode.com, make sure you are logged in | |
- Open the developer console (Ctrl+Shift+I on Firefox/Chrome) | |
- Get the value of your session cookie: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from aoc_secrets import AOC_COOKIE | |
YEAR = '2016' | |
def get_input(day): | |
req = requests.get(f'https://adventofcode.com/{YEAR}/day/{day}/input', headers={'cookie':'session='+AOC_COOKIE}) | |
return req.text | |
def get_example(day,offset=0): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
participants = '''@Greglimo1 | |
@maxencedevigne | |
@z3gh0st | |
@4quatre4quatre | |
@YavuzSonmez_ | |
@Tek_7987 | |
@Maskott6 | |
@corsicajack | |
@SmxPlayer | |
@le_jop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MiT | |
Smoked Chicken | |
Leet More | |
Hates Irony | |
sutegoma2 | |
lollersk8ers | |
European Nopsled Team | |
Routards | |
Plaid Parliament of Pwning | |
Shellphish |
NewerOlder