Giter Club home page Giter Club logo

aoc2022's Introduction

AOC2022

My personal attempts at the 2022 Advent of Code https://adventofcode.com/2022

Each day is in a two-digit day numbered folder

The *.py file is my code

advent-of-code-data

https://pypi.org/project/advent-of-code-data/

A slick way to download the puzzle data and submit answers

AOC Journal

Day 08

numpy!

  • 11 Dec, still lagging
  • Things I re-learned
    • numpy indexing
  • Things I learned -np.genfromtxt

Day 07

PurePosixPath!

  • 11 Dec, lagging a lot
  • /jssbn/lfrctthp/lfrctthp/ WHHYYYY!?!?!
  • Thanks to Rainow CSV VS Code Extension for enabling a rapid exploration of the dataset, although a momentary panic that LIKE wasn't supported was alleviated by the existence of like(col, str)
  • Things I re-learned
    • If you don't update the value of a loop variable, it's not helpful
    • When concatenating strings with + you have to str() integers
    • collections.defaultdict is awesome
    • EXPLORE YOUR DATASET
  • Things I learned
    • pathlib.PurePosixPath can be used to keep track of directories even if there's no actual file system!

Day 06

Counter!

  • 08 Dec, still lagging
  • Things I re-learned
    • Can't chain list.append() with list.pop() because they both return None
  • Things I learned
    • Counter.most_common()

Day 05

Transposed Lists!

  • 07 Dec, still lagging
  • Things I re-learned
    • inplace list operations
  • Things I learned
    • itertools.groupby()

Day 04

Sorted Lists! Mapped Tuples!

  • 06 Dec, still lagging
  • Got aocd working on Ubuntu
  • Things I re-learned
    • sorted() for lists
    • list.count()
  • Things I learned
    • (tuple(map(operator.sub,tups[0],tups[1]))) subtracts corresponding elements in a pair of tuples!

Day 03

Sets!

  • 05 Dec, still lagging
  • Didn't get around to debugging aocd
  • Things I re-learned
    • set.intersection()
    • string.isupper()
  • Things I learned
    • reduce(lambda x,y: set(x)&set(y), list_of_strings)

Day 02

Dictionaries!

  • Doubling up, 04 Dec
  • Things I re-learned
    • advent-of-code-data is a thing!
    • Must get your AOC session token
  • urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available

Day 01

Lists!

  • Started late, 04 Dec
  • Things I re-learned
    • from pathlib import Path
    • p = Path(__file__).with_name(n)
    • with p.open() as f: txt = f.read().splitlines()
    • To add items to a list, list.append() for a non-iterable, list.extend() for items in an iterable
  • Things I learned
    • You can use None in a variable when setting a stop slice index!

aoc2022's People

Contributors

cooknl avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.