advent-of-code-one-liners
🐍📅 One-line Python solutions for Advent of Code 2022 and 2023. (by savbell)
advent-of-code
By artesea
advent-of-code-one-liners | advent-of-code | |
---|---|---|
7 | 16 | |
110 | 0 | |
- | - | |
7.7 | 7.2 | |
5 months ago | 5 months ago | |
Python | PHP | |
- | - |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
advent-of-code-one-liners
Posts with mentions or reviews of advent-of-code-one-liners.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-12-08.
-
-❄️- 2023 Day 9 Solutions -❄️-
Today beats yesterday as my fastest solve! Fairly short too, so I'll include my one-line solutions in-line. q[9] contains the input. Here is my updated visual of the Basilisk, which combines all my one-line solutions into a single, disgusting line of code!
-
-❄️- 2023 Day 8 Solutions -❄️-
Here's today's one-liners! Part 1 on line 40 and Part 2 on line 66.
-
-❄️- 2023 Day 7 Solutions -❄️-
Day 7 Parts 1 & 2 in a single line of Python (one-liners on lines 60 and 105; multi-line solutions above them).
-
[2023 Days 1-6] [Python] Visualizing the length of the Basilisk, my Python one-liner that solves all the puzzles so far!
This visualization shows the number of characters in my one-line solutions for each part of each day. I actually wrote up a small script to automatically count the characters, calculate their percent of the whole, pick a proportional colour on a rainbow gradient, and save the rainbow line in an SVG file so I can easily use that as the snake's fill colour. This way, I can update the visualization each day as soon as I finish coding the solution. (Don't worry, I won't spam the subreddit with them — it's just for my own antics!) The automation script is here, if anyone is interested.
-
-❄️- 2023 Day 6 Solutions -❄️-
Here's my one-line solution for Day 6, both parts in one, with q[6] as the input file:
-
-❄️- 2023 Day 5 Solutions -❄️-
A day late to post, but here is my one-line Python solution for both parts of Day 5! q[5] has the input file contents.
-
Using __import__() for the same package multiple times within the same line of code?
I know that title is scary. But just like last year, I'm trying to solve as many days of Advent of Code in a single line of Python as I can. Because of this restriction, I'm using __import__('re') so I can use RegEx in my solutions rather than using the import statement (since that would add an additional line). But this means I have multiple instances that look like __import__('re').findall(r'\d', l) within a single line (as seen here). My question is: what is the impact of this? Is it importing the module every time it is called, or is it considered fully imported after the first call and just referenced in future calls? Is there any other/better way of doing this?
advent-of-code
Posts with mentions or reviews of advent-of-code.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-12-10.
-
-❄️- 2023 Day 11 Solutions -❄️-
Part 1: Over complicated, does several twists on the map, adding in extra .... lines where needed. Then plots where each galaxy [x,y] is, loop through each against any further galaxies. Simple difference between the x and y cords gives the distance. Sum all together.
-
-❄️- 2023 Day 10 Solutions -❄️-
Part 2: Using the Part 1 as a start point for moving around the path, this time I created a grid twice the size and then tracked each space I moved around filling in the gap between the neighbouring cells, this then left a 1 "pixel" gap for later. Ran a flood fill function at 0,0. My first attempt at a recursive function caused JS to RangeError: Maximum call stack size exceeded so I Googled some JS flood fill functions and adapted one. Finally I ran through all the even pixels, counting any that remained empty.
-
-❄️- 2023 Day 9 Solutions -❄️-
Part 1: Loop creating an array of differences to add to the main array, until you reach 0,0,0. Take the last number from each and add to get the next in the sequence.
-
-❄️- 2023 Day 8 Solutions -❄️-
Part 1: Pretty simple, sure I could reduce it a bit, but was quick with the answer.
-
-❄️- 2023 Day 7 Solutions -❄️-
Part 1: Parsed the input first, creating two scores for each hand, the first was how good the hand was giving 7 for a five of a kind, down to just 1 for high card. The second was an integer value of the hand in sudohex (T -> a, J -> b, Q -> c, K -> d, A -> e). I then just ran a quick sort on the array, using these two values to compare. (Thinking about it, I could have just appended the score from the first calc to the sudohex as it would have been the most significant digit).
-
-❄️- 2023 Day 6 Solutions -❄️-
Part 1 - simple brute force loop
-
-❄️- 2023 Day 5 Solutions -❄️-
Part 1 - Brute force, but was please with my parsing logic. Solved on day 5. When I realised what Part 2 needed, tried the brute force option whilst going away for lunch, but when I returned and it was still running knew that it wasn't going to be a great idea.
-
-🎄- 2022 Day 5 Solutions -🎄-
Part 1 Part 2
- -🎄- 2022 Day 4 Solutions -🎄-
- -🎄- 2021 Day 25 Solutions -🎄-
What are some alternatives?
When comparing advent-of-code-one-liners and advent-of-code you can also consider the following projects:
advent-of-code-2023-golang
adventOfCode2022
adventofcode2023 - https://adventofcode.com
advent-of-code
advent-of-code-2023
advent-of-code - Advent of Code
aoc - Advent of Code solutions
AdventOfCode-Day4-CampCleanup - .NET Core console app that solves the AdventOfCode Day 3 puzzle - Camp Cleanup
aoc23
advent-2022 - advent of code 2022 solutions in rust
AoC_23 - Had to create a new one ...
advent2022
advent-of-code-one-liners vs advent-of-code-2023-golang
advent-of-code vs adventOfCode2022
advent-of-code-one-liners vs adventofcode2023
advent-of-code vs advent-of-code
advent-of-code-one-liners vs advent-of-code-2023
advent-of-code vs advent-of-code
advent-of-code-one-liners vs aoc
advent-of-code vs AdventOfCode-Day4-CampCleanup
advent-of-code-one-liners vs aoc23
advent-of-code vs advent-2022
advent-of-code-one-liners vs AoC_23
advent-of-code vs advent2022