Our great sponsors
- Onboard AI - Learn any GitHub repo in 59 seconds
- InfluxDB - Collect and Analyze Billions of Data Points in Real Time
- SaaSHub - Software Alternatives and Reviews
-
Go. https://github.com/jasontconnell/advent/blob/master/2021/17/main.go
-
python modeling the equations was the way to go no need to loop over all time steps to get the en position, just using equations of motion
-
Onboard AI
Learn any GitHub repo in 59 seconds. Onboard AI learns any GitHub repo in minutes and lets you chat with it to locate functionality, understand different parts, and generate new code. Use it for free at www.getonboard.dev.
-
I actually did just that here! Completes part 2 in 400 mics. I think this could be optimized even further as well.
-
Kotlin (1177/731)
-
Go, 1093/563
-
-
adventofcode
Advent of Code solutions of 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 and 2023 in Scala (by sim642)
My Scala solution.
-
InfluxDB
Collect and Analyze Billions of Data Points in Real Time. Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.
-
Rust 991 / 584
-
So anyway, I started blasting
-
-
-
Basic C# solution with a straightforward try-everything simulation. This one could've been called 50 Thousand Iterations Under the Sea
-
Java https://github.com/SimonBaars/AdventOfCode-Java/blob/master/src/main/java/com/sbaars/adventofcode/year21/days/Day17.java
-
F#
-
-
Raku, 4863/4996. I thought for awhile about analytic solutions, concluded that it was probably covered by some calculus or linear algebra that I forgot, and decided to brute force it. I'm glad I did, since part 2 would be even more challenging analytically. I also managed to introduce a whole bunch of bugs, including an extended period of WTF until I realized that (25-7i).re ∈ 20..30 is False because Complex.re returns a Num but a Range of Int only accepts ∈ on Ints. Meanwhile, (25-7i).re ~~ 20..30 (smartmatch, not set containment) returns True because There's More Than One Way To Do It, And Some Of Them Are Subtly Wrong.
-
My solution in Go.
-
Full code here
-
Repository
-
-
This is so clean. I had it in my mind to not brute force from the beginning, but I should've given up given that up given the input size as well. It produced a lot more readable code than mine
-
My solutions as per usual at my Github
-
COBOL brute force.
-
ReScript code
-
Today's seemed weirdly easier than the previous days, like "too good to be true". Javascript solution
-
-
I first computed bounds and checked within a certain region of velocities. Compared with yesterday this was a piece of cake. I guess for must inputs the solution to part1 is simply y*(y+1)/2 where y is the absolute value of the lower bond - 1. github
-
My Python3 solution
-
-
-
-
-
Brute force like most people I think - kept wondering if there was going to be some horrible gotcha that meant brute force would not work, but it did.
-
Python day 17 solution (GitHub). Not the fewest lines of code, but used dataclasses and modular functions to try improve readability -- I got very confused with keeping track of indices of velocities vs coordinates in other people's posted solutions. I find dataclasses in Python can be a great way to be descriptive about the quantities you are iterating
-
-
Python 3 Just brute forced this one, why not? https://github.com/PeteEdley-EdleyIT/Advent-of-Code-2021-Day17/blob/master/Problem1.py
-
-
Nice! I've got a similar repo
-
-
Brute force Scala using tail recursion. There could be some optimizations on the velocity ranges I used, but it works. Hardest part was finding the proper minimum y velocity for part 2 (which I realized by looking at the example is just yRange.min)
-
I did the maths. My idea was that for a given time t, you can obtain all possible values of y and x (x is more complicated) such that after t step the probe is in the target area. GitLab.
-
-
TypeScript, Rare day where Part 1 was solved with a formula and Part 2 required brute force.
-
Slow
-
-
-
Python (3918/3570)
-
Part one: https://github.com/AugustsK/advent-of-code-solutions/blob/master/2021/day17/partOne.js
-
The whole solution: https://github.com/premun/advent-of-code/tree/main/src/17
-
My full solution: github
-
-
github: https://github.com/GMainardi/Advent-2021/tree/main/17
-
Elixir 3 ms each part, sme math might have been involved.
-
-
AdventOfCode2021
Some solutions for as much of advent of code 2021 as I can be bothered to do. (by TomHemery)
C# github Code footprint is small, vaguely sensible bounds on a brute force solution. Why not? I'm more proud of my commit name than my solution.
-
C# full solution
-
-
I'm using dumber bounds in Kotlin, Python, and Rust since it was easier. But basically, assuming 0 ≤ all target x, we only need to check 0 ≤ 𝚫x ≤ max target x —anything else immediately overshoots the target— and assuming all target y < 0, we only need to check min target y ≤ 𝚫y ≤ max abs target y —anything smaller will immediately overshoot and anything larger will also overshoot after returning to origin.
-
F# solution with Jupyter Notebook. Brute force. I actually solved Part 2 before solving Part 1, unknowingly.
-
adventofcode
My collection of Advent of Code solutions in a slightly overkill project setup 🙃👻 (by marcelblijleven)
-
Common Lisp. Very disappointing problem since you can just brute force over even unreasonable bounds quickly. Would have been more appropriate as a day 4 or 5 problem
-
-
-
Part 1
-
advent_of_code
This repository contains solutions to each of the problems in Advent of Code 2017, 2018, 2019, 2020, 2021 and 2022 in C++ (and 2020 in Python as well)
Solutions in C++: Part 1 Part 2 (As always, every file is a self ontained solution) Explanatory notes added for the math used.
-
-
Go
-
Python 3: Part 1 / Part 2
-
Python 3
-
-
-
-
-
Python3 - https://github.com/expsmartin/AOC2021/blob/main/d17.py Threw away 3 hours trying to solve this like a trick question. walked away for 6 hours, came back and assumed “nah, it reads how it reads” and solved p1 in 20 mins and p2 in 20 seconds.
-
-
-
I left a longer comment about why it is so in my solution, you can see it here!
-
-
-
AdventOfCode2021
Advent of Code 2021 challenge: 13 different languages, one chosen at random every day! (by Qualia91)
-
Python day 17
-
advent-of-code-go
All 8 years of adventofcode.com solutions in Go/Golang; 2015 2016 2017 2018 2019 2020 2021 2022
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives