This file contains 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 discord | |
import requests | |
import asyncio | |
from requests.auth import HTTPBasicAuth as authBasic | |
import datetime | |
import math | |
import time | |
TOKEN = "Discord bot token" | |
rttauth = authBasic("rttapi_username", "rttapi_password") | |
rttbase = "https://api.rtt.io/api/v1/json/search/" |
This file contains 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 | |
import math | |
#this should all be pretty extendable. hopefully there's more puzzles using this thing | |
#programming this thing was pretty fun lol | |
#parse puzzle input | |
pinput = requests.get("https://adventofcode.com/2019/day/9/input", headers={"Cookie": "session=[nope]"}).text | |
puzzle_input = pinput.split(",") | |
for i in range(0, len(puzzle_input)): | |
puzzle_input[i] = int(puzzle_input[i]) |
This file contains 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
w = open("input.txt") | |
bounds_x, bounds_y = 25, 6 | |
image = [] | |
done = False | |
def draw(img): | |
for row in img: | |
for i in row: | |
if i == "0": print(".." , end="") | |
elif i == "1": print("##" , end="") |
This file contains 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 | |
import math | |
from itertools import permutations | |
#had to make an entirely different file for this because i need to mess with it so much | |
#==Intcode Computer code (from day 5), slightly modified== | |
#parse puzzle input | |
pinput = requests.get("https://adventofcode.com/2019/day/7/input", headers={"Cookie": "session=[nope]"}).text | |
puzzle_input = pinput.split(",") | |
for i in range(0, len(puzzle_input)): |
This file contains 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 | |
import math | |
from itertools import permutations | |
#==Intcode Computer code (from day 5), slightly modified== | |
#parse puzzle input | |
pinput = requests.get("https://adventofcode.com/2019/day/7/input", headers={"Cookie": "session=[nope]"}).text | |
puzzle_input = pinput.split(",") | |
for i in range(0, len(puzzle_input)): | |
puzzle_input[i] = int(puzzle_input[i]) |
This file contains 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
connections_raw = [] | |
with open("input.txt") as f: | |
for line in f: | |
connections_raw.append(line.strip().split(")")) | |
print_orbits = False | |
print_santafind = False | |
satellites = {} | |
for conn in connections_raw: |
This file contains 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 | |
import math | |
#this should all be pretty extendable. hopefully there's more puzzles using this thing | |
#programming this thing was pretty fun lol | |
#parse puzzle input | |
pinput = requests.get("https://adventofcode.com/2019/day/5/input", headers={"Cookie": "session=[nope]"}).text | |
puzzle_input = pinput.split(",") | |
for i in range(0, len(puzzle_input)): | |
puzzle_input[i] = int(puzzle_input[i]) |
This file contains 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
puzzleinput = [] #insert your input here as an array, e.g. [11111, 22222] | |
validPasswords = 0 | |
for n in range(puzzleinput[0], puzzleinput[1]): | |
last_d = -1 | |
anyDoubles = False | |
notDecreasing = True | |
occurances = {} | |
for digit in str(n): | |
digit = int(digit) | |
if digit < last_d: notDecreasing = False |
This file contains 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
#difficulty spike.png | |
with open("input.txt") as f: #this one uses a file instead of a request | |
wire_a = f.readline() | |
wire_b = f.readline() | |
#parse instructions | |
wire_a_arr = wire_a.split(",") | |
wire_a_instruct = [] | |
for i in wire_a_arr: | |
direction = i[0] |
This file contains 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 | |
pinput = requests.get("https://adventofcode.com/2019/day/2/input", headers={"Cookie": "session=[nope]"}).text | |
ogstate = pinput.split(",") | |
for i in range(0, len(ogstate)): | |
ogstate[i] = int(ogstate[i]) | |
n = -1 | |
v = -1 |
NewerOlder