Coder Social home page Coder Social logo

surgi1 / adventofcode Goto Github PK

View Code? Open in Web Editor NEW
17.0 1.0 3.0 7.95 MB

ES6 solutions to Advent of Code puzzles.

License: The Unlicense

HTML 3.39% JavaScript 96.45% CSS 0.16%
programming-puzzles es6 javascript games visualization html5 advent-of-code advent-of-code-2015 advent-of-code-2016 advent-of-code-2017 advent-of-code-2018 advent-of-code-2019 advent-of-code-2020 advent-of-code-2021 advent-of-code-2022

adventofcode's Introduction

Introduction

During the Advent of year 2020 I realised that I finally have enough spare time to enjoy the legendary Advent of Code. While coding through the newly released puzzles, I decided to open one of the earlier years' set. Just to check a couple of those puzzles and see if it is any different. Fast-forward few days I found myself admiring the animated ASCII art that gets displayed on the calendar main page after completing the whole set. Solving these little, well-thought-through tasks became a habit, rendering me overjoyed and satisfied.

Hence comes this repo, documenting my path to gathering now 450โ˜… stars and beyond, as I was fortunate enough to enjoy the fun even in the years that followed.

Lessons learnt

  • While in trouble, go back to the puzzle description. Chances are that you've missed or misread a key information. Many hours were wasted because of not following this rule closely.
  • Brute-force is often a working solution, if not a desired approach. In those times where the crucial observation that would reduce the computation complexity by orders of magnitude just did not occur to you yet, maybe it is possible to optimize your code, maybe run it in parallel, and have a solution in couple of (tens of) minutes. Not pretty nor elegant, thats for sure. Working? May be.
  • There are times where brute-force just doesn't work, as the projected run time is in days even with all the easily available optimalizations. In those times go to point 1; chances are you've missed something in the puzzle description. If not, a good nights rest should do it. Solutions sometimes lie outside the box.
  • If part 1 of the puzzle smells of a linked list, it will require a linked list approach for part 2. Granted.
  • A number of puzzles are alike. Abstracting meaningful parts of your solution might be worth it. Talking Distance maps, Graph traversing algorithms or ASCII-art rendering here.
  • This one is even mentioned in one of the puzzle descriptions: Do not always aim to solve all the imaginable puzzle configurations. Look for simplifications, boundaries, try to cut the corners.
  • Visualization and observed simulation often helps moving forward even with the toughest problems!
  • Real puzzle input is the important one; it might contain properties the sample input lacked, and may lead to observations necessary to solve the puzzle.
  • And last but not least, remember that you don't have to solve everything by your code. Cumbersome inputs can be converted into more manageable state by a tool of choice rather than by lengthy regexes, difficult math problems can be passed to Wolfram Alpha, complicated logic can be solved manually, often even as a game, Graphviz is your good friend as well. Your task is to find the answers to the puzzles, and the means and measures you take to do so are also yours.
  • For general puzzle categorization and difficulty roster, check this awesome summary.

Advent of Code

https://adventofcode.com/events

JavaScript solutions, executed in browser or node.

Code is pretty raw most of the time, with few exceptions.

Contains far more than healthy amount of visualisations, also here and here (captured on YouTube too) or playable games where possible or available.

Whole repo is deployed on Github Pages, links to individual puzzle solutions are in their respective readmes. Run only at your own risk of course.

Roster

Teasers

AoC 2021 - Day 23: Amphipod

Troopahs

AoC 2018 - Day 15: Battle between elves and goblins in full swing

Battle between elves and goblins in full swing

AoC 2019 - Day 15: Intcode Maze

Intcode Maze

AoC 2023 - Day 19: 4D Intervals

4D Intervals

adventofcode's People

Contributors

surgi1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.