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
| # 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
| # 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
| 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
| # 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 |
OlderNewer