How hard is all 50 stars?

  Рет қаралды 3,634

chris biscardi

7 ай бұрын

Advent of Code 2023 recap.
## Chapters
00:00 What is Advent of Code?
00:25 The Setup I used and how it worked out
02:28 The Leptos/Wasm site
03:04 The Justfile
04:21 Next year's changes
06:03 The Day 1 AoC experience
08:54 Solving the rest of the problems
10:45 tracing
11:00 bool::then_some
11:38 miette
12:33 set_from
12:54 rstest
13:24 std::iter::*
14:18 point in polygon
14:51 dynamic programming
15:23 2048
15:33 pathfinding
17:22 Bevy visualizations!
17:55 day 25
19:00 Useful crates
19:06 nom
19:44 Itertools
21:00 petgraph/pathfinding
21:45 glam
22:44 num
22:57 tracing
23:30 rayon
23:59 pretty_assertions
24:11 What did I learn
24:30 point in polygon
24:40 shoelace and pick's
24:55 Advent Specifics
25:27 stoer-wagner minimum cut
25:38 How hard is it to complete Advent of Code?

Пікірлер: 28
@holly_hacker
@holly_hacker 7 ай бұрын
About parsing libraries: I've parsed every single day using simple `string.lines()`, `split`/`split_once` code and hardcoded indexing. The inputs are all extremely structured which makes this a very simple method, and for nearly every day I was able to parse the input in less than 10 lines of code (often in just a few). Pulling in a parsing library seems very overkill to me.
@katech6020
@katech6020 7 ай бұрын
I did the same thing as well, the inputs are fairly simple to parse directly
@chrisbiscardi
@chrisbiscardi 7 ай бұрын
that's totally valid and I'll never tell you not to do that if that's how you want to do it. AoC, as you said, always produces valid input so an error in parsing is always an error in the player's program. Using a parsing library for a parsing task is not something I consider overkill though.
@ragectl
@ragectl 7 ай бұрын
thanks for doing this recap. It's good to hear what you enjoyed about going through it, and what recommendations you have afterwards 👍
@xixiaofin
@xixiaofin 6 ай бұрын
Thank you Chris! I'm half a year into Rust and year 2023 was also my first time doing AoC. I reached day18 or so and started to see the puzzles moved from a vehicle for me to learn Rust towards 2D 3D algorithm design, thus I stopped. If I had your suggestion (do part1 only when learning a new lang) ahead of time, I would have had the stamina to the end line. I'm surprised that you have such a sophisticated script surrounding AoC. But I understand all those aspects matter if we really wanna learn Rust well (such as benchmarking). Looking forward to learning more from your past AoC and future Rust videos! These ones add great values to newbies like me!
@ramkumarkb
@ramkumarkb 7 ай бұрын
It was terrific learning experience following you thru the entire journey of 25 days. I cannot thank you enuf for the work and sharing the immense knowledge with the community. 🙏
@wtcxdm
@wtcxdm 7 ай бұрын
Thanks for the awesome video! I am learning rust using the book and trying to get familiar by practicing advent of code. But I get stuck from time to time (for example, day 10 part 2 atm) As the quiz spends too much time for me, I think I will go back to the book… to keep my leaning journey going
@Saturate0806
@Saturate0806 7 ай бұрын
well done
@anon_y_mousse
@anon_y_mousse 7 ай бұрын
I'd like to know why they don't want the input files included in repositories since AFAIK they're unique to each user but all equally correct as tests of the code. As for reading the input, I downloaded it from the site directly and had in01.txt for the sample and in02.txt for the regular input. Although, I still used command line parameters to specify which input file to use just in case there were more than two sets of input to be tested against. I don't agree that the problems weren't well specified, but then I did use C to do them.
@hukasu
@hukasu 6 ай бұрын
the challenge that i impose on myself when doing AoC is std only, no dependencies done 2022 and 2023 in Rust with that challenge
@chrisbiscardi
@chrisbiscardi 6 ай бұрын
That's a pretty good challenge, especially if you're familiar with Advent type problems and Rust already.
@Thefrollickingnerd
@Thefrollickingnerd 7 ай бұрын
How come the programs run faster on windows compared to mac?
@chrisbiscardi
@chrisbiscardi 7 ай бұрын
any number of reasons really. Probably mostly that the windows pc has a newer cpu. (m1 vs ryzen 7950x)
@cat_or_not
@cat_or_not 7 ай бұрын
I just fetched the inputs at runtime from advent of code to avoid syncing input files across different computers.
@chrisbiscardi
@chrisbiscardi 7 ай бұрын
The site makes a note about making sure you're not making too many requests to the servers, but doesn't define how many is too many, so I generally avoid putting any more load on their system than I have to.
@TRex266
@TRex266 7 ай бұрын
Should be easy to implement some sort of caching though, right?
@chrisbiscardi
@chrisbiscardi 7 ай бұрын
honestly, committing it to the git repo is already the best form of caching to use in this scenario. Anything else is a workaround.
@pineberryfox
@pineberryfox 7 ай бұрын
i don't think day 1 part 2 is underspecified at all! i think a lot of the complaints regarding come from people saying "replace string by digit", but there is no mention of replacement in the problem statement. it only asks: what's the first (leftmost) valid "digit" (spelled-out or otherwise) and what's the last (rightmost) valid "digit". in "treb7uchet", it's 7 and 7, so overlap is shown off in the example input and has to be accounted for in part 1!
@chrisbiscardi
@chrisbiscardi 7 ай бұрын
> it looks like some of the digits are actually spelled out with letters > aoc day 1, part 2 A valid interpretation of this is that digits are being replaced by words, especially since part 1 included no overlapping. 7 and 7 is not an overlap, it is the same number, and the problem description does not say "search from the left and the right and find the first number you can from either direction". The overlap in the second test case is inconsequential and can be completely ignored/missed because it is inconsequential and has no effect on the answer. The player is left to wonder if the overlap should read one way or another *because* it was underspecified and inconsequential in the test input. > the first digit and the last digit The "last digit" changes based on how you interpret the input, which is not well-specified in the test input or the problem description.
@pineberryfox
@pineberryfox 7 ай бұрын
@@chrisbiscardi I doubt that we will agree on this. But consider twoneight: left-to-right string replacement would have first- and last-digit be 2,8. Right-to-left replacement would give the same answer. But ascending-numerical-order replacement would give 1,1. i.e. string-replacement is not a well-defined method without further information. String-search without-replacement is well-defined: it gives the correct 2,8 here, and 7,9 for sevenine, regardless of the direction you process or the order you search. I would never have imagined the "replacement"-based reading at all, but given the choice between an interpretation that gives a well-defined solution and an interpretation that cannot be meaningful, I'll take the well-defined one any day.
@chrisbiscardi
@chrisbiscardi 7 ай бұрын
@@pineberryfox yeah, you're so close here though. "given the choice of interpretations" is what you're saying here, but there shouldn't have been a choice. The puzzle should tell you the rules of the game and it didn't. You chose correctly, which is great, but there is nothing about the puzzle which indicates the correct interpretation until you run the solution on the real input. The puzzle could have said "the string numbers read the same right-to-left and left-to-right", but it didn't. The puzzle could've given an example of "twoneight" being 218, but it didn't. That's a choice in interpretation that you made based on incomplete information. 70,000+ people hit this issue and dropped off permanently. There is something wrong *with the puzzle* when almost a third of players are dropping off on day 1.
@pineberryfox
@pineberryfox 7 ай бұрын
@@chrisbiscardi The puzzle could not have given an example of twoneight being 218, because it isn't, it's 28. Explaining that it contains instances of "two", "one", and "eight" where "two" is first and "eight" is last might be fine, but then you're giving people a lot of extra, unnecessary information. I'll concede that the phrase might be ambiguous. But then, if you have two ways to interpret something, and one way leads to more unaddressed ambiguity while the other clears it up immediately, the unambiguous way is the way. Don't get me wrong, i'm not saying the puzzle would be made worse by including an example like "eightwo", i just feel like the couple people i've seen rag on its lack are being overly critical. Maybe Eric disagrees with me, agrees with you, that's fine too. On people leaving: i'd expect the curve to be roughly Zipfian, so I'm not sure how much the puzzle whose solution is to scan a string one-position-at-a-time is contributing to people leaving. If it scared people off: that sucks.
@chrisbiscardi
@chrisbiscardi 7 ай бұрын
@@pineberryfox yeah, my critique is not meant to be "puzzle bad" but rather "55k *more* people dropped off this year on day 1 than last year, even though the total participation was pretty constant at 300k-ish, and I think this is why"
@adrianjdelgado
@adrianjdelgado 7 ай бұрын
bool::then_some gets flagged by clippy as an antipattern. Doing a filter followed by a map looks cleaner.
@chrisbiscardi
@chrisbiscardi 7 ай бұрын
absolutely impossible to say why you got a clippy warning without seeing any code or even the warning id that you got. It does not get flagged the way I show in the video.
@adrianjdelgado
@adrianjdelgado 7 ай бұрын
@@chrisbiscardi My bad. The lint is called filter_map_bool_then and only applies to bool::then. The clippy lints page cites not working on then_some as a limitation.
@chrisbiscardi
@chrisbiscardi 7 ай бұрын
@@adrianjdelgado thanks for mentioning the name of the lint. I went through and made a bunch of changes to see what this would look like. While it is ok in some cases, in others it results in bending over backwards to satisfy the lint. Its also notable that the original issue that caused this lint to be created wasn't motivated by the use of then_some, it was motivated by the use of a dozen-line complex computation inside of a then(). None of my usages of then_some satisfy that condition (they are all simple "use this value"s), which the lint as-implemented also doesn't check for. In the end I decided not to apply the changes. Clippy style lints are particularly opinion-based, which is why they're in clippy and under the "style" group in the first place, so while I might follow it in the future, I don't think the change is worth it right now. github.com/ChristopherBiscardi/advent-of-code/pull/20/files
@adrianjdelgado
@adrianjdelgado 7 ай бұрын
@@chrisbiscardi Fair enough :)
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 24 МЛН
Double Stacked Pizza @Lionfield @ChefRush
00:33
albert_cancook
Рет қаралды 107 МЛН
Llegó al techo 😱
00:37
Juan De Dios Pantoja
Рет қаралды 57 МЛН
Что делать если в телефон попала вода?
0:17
Лена Тропоцел
Рет қаралды 3,2 МЛН
Лучший браузер!
0:27
Honey Montana
Рет қаралды 832 М.
Kumanda İle Bilgisayarı Yönetmek #shorts
0:29
Osman Kabadayı
Рет қаралды 2,2 МЛН
Xiaomi SU-7 Max 2024 - Самый быстрый мобильник
32:11
Клубный сервис
Рет қаралды 533 М.