Skip to content

Instantly share code, notes, and snippets.

@glitchcowboy
glitchcowboy / aoc-day1.go
Created January 3, 2024 15:49
AoC-Day1.go
package main
import (
"os"
"encoding/csv"
"regexp"
"fmt"
"strings"
"strconv"
)
@glitchcowboy
glitchcowboy / AoC-Day3-regexified.py
Created January 6, 2024 13:25
AoC-Day3-regexified
import pandas as pd
import re
def main():
df = pd.read_csv("input.txt", index_col=False)
re_number = re.compile(r'\d')
re_spec_char = re.compile(r'[*&%\-/#&$@+=]')
re_spec_char_dot = re.compile(r'[*&%\-/#&$@+=.]')
@glitchcowboy
glitchcowboy / day-4.py
Last active January 8, 2024 20:31
Glitchcowboy's Day4 part 1 in python
import pandas as pd
#borrowed some things from deom23
def main():
df = pd.read_csv('input.txt', delim_whitespace=True, header=None)
total_score = 0
for row in range(df.shape[0]):
row_score = 0
winners, numbers_i_have = df.iloc[row, 2:12].tolist(), df.iloc[row, 13:39].tolist()
correct = [x for x in numbers_i_have if x in winners]
@glitchcowboy
glitchcowboy / day4-part2-broken.py
Last active January 9, 2024 03:15
day4-part2-barak
import pandas as pd
def main():
df = pd.read_csv('input.txt', delim_whitespace=True, header=None)
total_score = 0
df.insert(0, 'count_multiplier', 1) # set up an initial count multiplier field
for row in range(df.shape[0]):
row_score = 0
@glitchcowboy
glitchcowboy / pygame-one.py
Created January 16, 2024 03:13
pygame-one
# Import the pygame module
import pygame
# Import random for random numbers
import random
# Import pygame.locals for easier access to key coordinates
# Updated to conform to flake8 and black standards
from pygame.locals import (
RLEACCEL,
K_UP,