Giter Site home page Giter Site logo

advent-of-code-2022's Introduction

Advent of Code 2022

Link to the official AoC

My own solutions to the challenges of AoC this year in Python.

Major update to my functional programming journey: In order to "force" the proper FP style to my Python code, I have spent half a day to create an utility class Chainable that wraps around any Python iterable (including map/filter objects, etc...) enabling function chaining. Of course one can do the same in Python using Pandas or PySpark but these are heavy libraries with great capability which would be an overkill. Starting from Day 5, this will be my coding style until the end.

Update Day 12: BFS algorithm -> not ideal to execute the algo using FP. I tried my best to use FP wherever I can

Update Day 11: Interesting day. Results in part 2 wouldn't be possible without bounding the numbers to prevent numerical explosion. Once again, FP was little possible since state changes are significant and procedural

Update Day 7: Haven't yet found a good way to generate a filesystem's tree from a list of instructions using FP, since the FS's state changes after each line and the correct tree can only be generate procedurally from top to bottom. The solution for this Day is unfortunately classical Python

Update Day 5: The input file on this day was quite annoying to parse into data, so from now on I will spend some minutes of doing text formatting before actually coding to save time. My FP solution works with original input given by the author of AoC.

Update Day 4: I decided that programming procedurally is way too cliché, so I switched to functional programming style, still in Python. Since this is not the best language to do FP using built-in functions, the indentation and bracketing is kinda eyesoring, so I'm trying my best to make the code readable.

Executing python XX.py fname will display the answers to all the parts of day XX's challenge whose input is read from the file named fname

Since this is an event where coders compete for earlies correct submission, my original code that produces the answer is not shown in this repo. Instead, variable names and perhaps a few logics are modified and shown for better readability.

And last but not least, the answers are in no way the fastest/most optimal way to solve the challenges. The key to AoC is just early correct submission, that's it.

advent-of-code-2022's People

Contributors

dqtvictory avatar

Watchers

 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.