Awesome
<h1 align="center">🎄 Advent of Code 🎄</h1> <h6 align="center">by <a href="https://github.com/npanuhin">@npanuhin</a></h6> <div align="center"> <img src=".github/website/AoC.gif" width="600px"> </div>This is a repository of my Advent of Code solutions. Some puzzles are accompanied by concise descriptions 😉
I try to optimize each solution as much as possible, so although they are written in Python, many run in less than a second!
<!-- Main table start --> <table> <tr> <th></th> <th align="center"><a href="2020">2020</a></th> <th align="center"><a href="2021">2021</a></th> <th align="center"><a href="2023">2023</a></th> </tr> <tr> <td>Day 1</td> <td align="center"><a href="2020/Day%2001">💎💎</a></td> <td align="center"><a href="2021/Day%2001/part1.py">⭐</a><a href="2021/Day%2001/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2001/part1.py">⭐</a><a href="2023/Day%2001/part2.py">⭐</a></td> </tr> <tr> <td>Day 2</td> <td align="center"><a href="2020/Day%2002">💎💎</a></td> <td align="center"><a href="2021/Day%2002/part1.py">⭐</a><a href="2021/Day%2002/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2002/part1.py">⭐</a><a href="2023/Day%2002/part2.py">⭐</a></td> </tr> <tr> <td>Day 3</td> <td align="center"><a href="2020/Day%2003">💎💎</a></td> <td align="center"><a href="2021/Day%2003/part1.py">⭐</a><a href="2021/Day%2003/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2003/part1.py">⭐</a><a href="2023/Day%2003/part2.py">⭐</a></td> </tr> <tr> <td>Day 4</td> <td align="center"><a href="2020/Day%2004">💎💎</a></td> <td align="center"><a href="2021/Day%2004/part1.py">⭐</a><a href="2021/Day%2004/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2004/part1.py">⭐</a><a href="2023/Day%2004/part2.py">⭐</a></td> </tr> <tr> <td>Day 5</td> <td align="center"><a href="2020/Day%2005">💎💎</a></td> <td align="center"><a href="2021/Day%2005/part1.py">⭐</a><a href="2021/Day%2005/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2005/part1.py">⭐</a><a href="2023/Day%2005/part2.py">⭐</a></td> </tr> <tr> <td>Day 6</td> <td align="center"><a href="2020/Day%2006">💎💎</a></td> <td align="center"><a href="2021/Day%2006/part1.py">⭐</a><a href="2021/Day%2006/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2006/part1.py">⭐</a><a href="2023/Day%2006/part2.py">⭐</a></td> </tr> <tr> <td>Day 7</td> <td align="center"><a href="2020/Day%2007">💎💎</a></td> <td align="center"><a href="2021/Day%2007/part1.py">⭐</a><a href="2021/Day%2007/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2007/part1.py">⭐</a><a href="2023/Day%2007/part2.py">⭐</a></td> </tr> <tr> <td>Day 8</td> <td align="center"><a href="2020/Day%2008">💎💎</a></td> <td align="center"><a href="2021/Day%2008/part1.py">⭐</a><a href="2021/Day%2008/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2008/part1.py">⭐</a><a href="2023/Day%2008/part2.py">⭐</a></td> </tr> <tr> <td>Day 9</td> <td align="center"><a href="2020/Day%2009">💎💎</a></td> <td align="center"><a href="2021/Day%2009/part1.py">⭐</a><a href="2021/Day%2009/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2009/part1.py">⭐</a><a href="2023/Day%2009/part2.py">⭐</a></td> </tr> <tr> <td>Day 10</td> <td align="center"><a href="2020/Day%2010">💎💎</a></td> <td align="center"><a href="2021/Day%2010/part1.py">⭐</a><a href="2021/Day%2010/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2010/part1.py">⭐</a><a href="2023/Day%2010/part2.py">⭐</a></td> </tr> <tr> <td>Day 11</td> <td align="center"><a href="2020/Day%2011">💎💎</a></td> <td align="center"><a href="2021/Day%2011/part1.py">⭐</a><a href="2021/Day%2011/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2011/part1.py">⭐</a><a href="2023/Day%2011/part2.py">⭐</a></td> </tr> <tr> <td>Day 12</td> <td align="center"><a href="2020/Day%2012">💎💎</a></td> <td align="center"><a href="2021/Day%2012/part1.py">⭐</a><a href="2021/Day%2012/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2012/part1.py">⭐</a><a href="2023/Day%2012/part2.py">⭐</a></td> </tr> <tr> <td>Day 13</td> <td align="center"><a href="2020/Day%2013/part1.py">⭐</a><a href="2020/Day%2013/part2.py">⭐</a></td> <td align="center"><a href="2021/Day%2013/part1.py">⭐</a><a href="2021/Day%2013/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2013/part1.py">⭐</a><a href="2023/Day%2013/part2.py">⭐</a></td> </tr> <tr> <td>Day 14</td> <td align="center"><a href="2020/Day%2014">💎💎</a></td> <td align="center"><a href="2021/Day%2014/part1.py">⭐</a><a href="2021/Day%2014/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2014/part1.py">⭐</a><a href="2023/Day%2014/part2.py">⭐</a></td> </tr> <tr> <td>Day 15</td> <td align="center"><a href="2020/Day%2015">💎💎</a></td> <td align="center"><a href="2021/Day%2015/part1.py">⭐</a><a href="2021/Day%2015/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2015/part1.py">⭐</a><a href="2023/Day%2015/part2.py">⭐</a></td> </tr> <tr> <td>Day 16</td> <td align="center"><a href="2020/Day%2016/part1.py">⭐</a><a href="2020/Day%2016/part2.py">⭐</a></td> <td align="center"><a href="2021/Day%2016/part1.py">⭐</a><a href="2021/Day%2016/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2016/part1.py">⭐</a><a href="2023/Day%2016/part2.py">⭐</a></td> </tr> <tr> <td>Day 17</td> <td align="center"><a href="2020/Day%2017/part1.py">⭐</a><a href="2020/Day%2017/part2.py">⭐</a></td> <td align="center"><a href="2021/Day%2017/part1.py">⭐</a><a href="2021/Day%2017/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2017/part1.py">⭐</a><a href="2023/Day%2017/part2.py">⭐</a></td> </tr> <tr> <td>Day 18</td> <td align="center"><a href="2020/Day%2018/part1.py">⭐</a><a href="2020/Day%2018/part2.py">⭐</a></td> <td align="center"><a href="2021/Day%2018/part1.py">⭐</a><a href="2021/Day%2018/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2018/part1.py">⭐</a><a href="2023/Day%2018/part2.py">⭐</a></td> </tr> <tr> <td>Day 19</td> <td align="center"><a href="2020/Day%2019/part1.py">⭐</a><a href="2020/Day%2019/part2.py">⭐</a></td> <td align="center"><a href="2021/Day%2019/part1.py">⭐</a><a href="2021/Day%2019/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2019/part1.py">⭐</a><a href="2023/Day%2019/part2.py">⭐</a></td> </tr> <tr> <td>Day 20</td> <td align="center"><a href="2020/Day%2020/part1.py">⭐</a><a href="2020/Day%2020/part2.py">⭐</a></td> <td align="center"><a href="2021/Day%2020/part1.py">⭐</a><a href="2021/Day%2020/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2020/part1.py">⭐</a><a href="2023/Day%2020/part2.py">⭐</a></td> </tr> <tr> <td>Day 21</td> <td align="center"><a href="2020/Day%2021/part1.py">⭐</a><a href="2020/Day%2021/part2.py">⭐</a></td> <td align="center"><a href="2021/Day%2021/part1.py">⭐</a><a href="2021/Day%2021/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2021/part1.py">⭐</a><a href="2023/Day%2021/part2.py">⭐</a></td> </tr> <tr> <td>Day 22</td> <td align="center"><a href="2020/Day%2022/part1.py">⭐</a><a href="2020/Day%2022/part2.py">⭐</a></td> <td align="center"><a href="2021/Day%2022/part1.py">⭐</a><a href="2021/Day%2022/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2022/part1.py">⭐</a><a href="2023/Day%2022/part2.py">⭐</a></td> </tr> <tr> <td>Day 23</td> <td align="center"><a href="2020/Day%2023/part1.py">⭐</a><a href="2020/Day%2023/part2.py">⭐</a></td> <td align="center"><a href="2021/Day%2023/part1.py">⭐</a><a href="2021/Day%2023/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2023/part1.py">⭐</a><a href="2023/Day%2023/part2.py">⭐</a></td> </tr> <tr> <td>Day 24</td> <td align="center"><a href="2020/Day%2024/part1.py">⭐</a><a href="2020/Day%2024/part2.py">⭐</a></td> <td align="center"><a href="2021/Day%2024/part1.py">⭐</a><a href="2021/Day%2024/part2.py">⭐</a></td> <td align="center"><a href="2023/Day%2024/part1.py">⭐</a><a href="2023/Day%2024/part2.py">⭐</a></td> </tr> <tr> <td>Day 25</td> <td align="center"><a href="2020/Day%2025/part1.py">⭐⭐</a></td> <td align="center"><a href="2021/Day%2025/part1.py">⭐⭐</a></td> <td align="center"><a href="2023/Day%2025/part1.py">⭐⭐</a></td> </tr> </table> <!-- Main table end -->Also check out these cool animated annual AoC images!
💎 — A brief description is available
Some facts about this repository:
- My goal is to keep solutions as close to the original as possible, so I generally do not edit past solutions. Sometimes I correct the code style (without even remembering what the task was about), but in the future I will try not to do this
I also follow some rules for writing my solutions:
-
The entire repository is PEP8 compliant, as verified by the
flake8
linter (with the exception of some rules) -
Input files may contain any number of empty lines, especially at the end. In some cases, this also applies to whitespace characters.<br> Currently I like to handle this rule using the following general snippet to read files:
with open('input.txt') as file: lines = list(filter(None, map(str.strip, file)))
<h3 align="center">Gallery of amazing annual Advent of Code images</h3>
<table> <tr> <td align="center"><a href="2020"><img alt="" src=".github/website/2020/canvas.svg"></a><b>2020</b></td> <td align="center"><a href="2021"><img alt="" src=".github/website/2021/canvas.svg"></a><b>2021</b></td> </tr> <tr> <td align="center"><a href="2022"><img alt="" src=".github/website/2022/canvas.svg"></a><b>2022</b></td> <td align="center"><a href="2023"><img alt="" src=".github/website/2023/canvas.svg"></a><b>2023</b></td> </tr> </table>If you computer scruggles to render smooth animations, buy a new one1 :)
Wanna know how I automatically created animated vector images with transparent gradient borders within GitHub Markdown? Check out this folder
Footnotes
-
Joking of course! It's just that almost all annual AoC images contain a ton of HTML objects, each with its own animation. Rendering one image on a modern hardware is easy, but when there are many of them, it becomes a mess)
In all seriousness, I'm not sure if I want to hold on to these animations or drop some of them ↩