|
the talent deficit posted:the 2019 one wasn't bad. you could write the emulator in like 30 minutes; it was very simple. you also didn't need to use sdl or any kind of graphics. the breakout puzzle was easier to solve analytically than by actually playing the game I can see it being simple if you are already familiar with that domain, otherwise that was quite a steep curve.
|
# ? Dec 1, 2022 21:59 |
|
|
# ? May 3, 2024 04:01 |
|
FalseNegative posted:Please do, j k, etc fascinate me. honestly the bigger issue is that it doesn't turn out that interesting, in that it is some splits and sums with fewer characters. code:
|
# ? Dec 1, 2022 22:13 |
|
FalseNegative posted:I can see it being simple if you are already familiar with that domain, otherwise that was quite a steep curve. also it was kind of unfriendly for some of the more fun aspects of aoc, i.e. trying something new or weird or simply shaking off some rust. if your approach didn't do it very well (e.g. running it in excel at great effort) it got annoying to have it resurface, and it had a tinge of doing real work when you found yourself refactoring your thing a second time. didn't mind it too much, but probably as well to steer a bit clear of it. e: otoh every year aoc winds up having that pain point where you go "huh, this is just work isn't it?", but it is usually only a couple of the days.
|
# ? Dec 1, 2022 22:19 |
|
did it in swift, spent more time finding out you can't statically link a swift package into a command-line tool in xcode because i got tired of opening the schemes dialog to change the command line parameters and wanted to run from the terminal but it could never find the framework dynamically that way. this is how all my side projects end up, by the way.
|
# ? Dec 2, 2022 00:04 |
|
spankmeister posted:did day1 in python in like 5 minutes but gonna try rust now lol yeah i feel like im cheating by not writing my own sort
|
# ? Dec 2, 2022 01:07 |
|
Archduke Frantz Fanon posted:lol yeah i feel like im cheating by not writing my own sort why are you sorting? you can do both parts in a single pass through your input.
|
# ? Dec 2, 2022 02:40 |
|
MrQueasy posted:why are you sorting? you can do both parts in a single pass through your input. manually accumulating top-k is usually pretty grody code compared to "sort, take elements in order".
|
# ? Dec 2, 2022 02:46 |
|
i guess if your language has an easy priority queue implementation then it's not so bad though
|
# ? Dec 2, 2022 02:48 |
|
MrQueasy posted:why are you sorting? you can do both parts in a single pass through your input. oh i guess i could have just extended what i was doing for part one but list.sort() is so easy
|
# ? Dec 2, 2022 02:53 |
|
Archduke Frantz Fanon posted:oh i guess i could have just extended what i was doing for part one but list.sort() is so easy amen to that, I think the # of elves was an order of magnitude smaller than the total number of lines in my input. what’s a couple nanoseconds between friends?
|
# ? Dec 2, 2022 03:03 |
|
after doing day 1 last midnight in python, i just got finished trying it in haskell, a language i have squinted at on occasion. it took me an hour and i could feel my brain operating differently
|
# ? Dec 2, 2022 03:13 |
|
yeah if anything these puzzles are great for highlighting just how great python is for stuff like this
|
# ? Dec 2, 2022 03:18 |
|
I am doing it in Racket this year because I refuse to learn any employable job skills from the elf puzzle game
|
# ? Dec 2, 2022 03:32 |
|
Jabor posted:i guess if your language has an easy priority queue implementation then it's not so bad though i felt like a dope because i did the manual one-pass accumulation thing and then only after submitting did i realize i could replace my whole part 2 solution with one function call to python's heapq ...not that doing it in linear time actually matters with how small the data size is
|
# ? Dec 2, 2022 03:39 |
|
Yeah I felt bad about doing a sort instead of a single pass on the second part of day 1, then remembered that I was calling the file read separately for each part (I keep the day’s input in a separate text file to keep down on clutter), so the sort was the least of my optimization crimes.
|
# ? Dec 2, 2022 05:00 |
|
PIZZA.BAT posted:yeah if anything these puzzles are great for highlighting just how great python is for stuff like this Python is ok. But Kotlin is still the best balance of expressive/type safety I've used in a while. code:
|
# ? Dec 2, 2022 05:48 |
|
I feel a bit bad about all the switches and if statements in my code for day 2. But at least I only read the input file once, so that's a huge improvement from day 1...
|
# ? Dec 2, 2022 06:34 |
|
LanceHunter posted:I feel a bit bad about all the switches and if statements in my code for day 2. But at least I only read the input file once, so that's a huge improvement from day 1... You think you feel bad, mine was using ridiculously overengineered enum/sealed classes.
|
# ? Dec 2, 2022 07:08 |
|
i did some major mind math to think about array indices and reverse dictionary lookups. not sure where my head was tbh
|
# ? Dec 2, 2022 07:17 |
|
I'm having fun coming up with parallel algorithms for these, even if the inputs are too small for that to be sensible. Going well so far. In 2018 I got a bit tired of the later problems that were more about fiddly details than problem-solving (I remember having to encode some RPG combat ruleset).
|
# ? Dec 2, 2022 08:44 |
|
day 2 is one of those where aoc philosophy becomes a real question, i.e. deciding if one thinks it is a pure programming exercise and therefore we should try to make a nice program that has all the logic to solve the thing directly embedded, or is it problem solving so just do what solves the problem the most conveniently. i.e., whether one thinks it is in the spirit to just write the scoring as dictionaries covering the 9 cases code:
e: sort debate falls in this as well, as it is unlikely you'd ever manage to make the extra log n factor matter in an aoc problem, so a matter of the standard we hold ourselves to. Cybernetic Vermin fucked around with this message at 11:11 on Dec 2, 2022 |
# ? Dec 2, 2022 09:33 |
|
Cybernetic Vermin posted:e: sort debate falls in this as well, as it is unlikely you'd ever manage to make the extra log n factor matter in an aoc problem, so a matter of the standard we hold ourselves to. You can do that sort in linear time, so it's only a constant factor that matters.
|
# ? Dec 2, 2022 10:43 |
|
Athas posted:You can do that sort in linear time, so it's only a constant factor that matters. if we're to *actually* "actually" this though every aoc solution is in constant time since the input is a given constant
|
# ? Dec 2, 2022 11:07 |
|
Cybernetic Vermin posted:if we're to *actually* "actually" this though every aoc solution is in constant time since the input is a given constant I usually run my solution on the small sample input to see that I've got it right before running on my real input.
|
# ? Dec 2, 2022 11:26 |
|
Cybernetic Vermin posted:if we're to *actually* "actually" this though every aoc solution is in constant time since the input is a given constant OK sure, but the context was scaling up to hypothetical larger problem sizes, and you can sort this sequence using a radix sort. Although I suppose if you truly don't put any bounds on the input, that ends up being O(log(k)n), where 'k' is largest sum.
|
# ? Dec 2, 2022 11:30 |
|
Athas posted:OK sure, but the context was scaling up to hypothetical larger problem sizes, and you can sort this sequence using a radix sort. Although I suppose if you truly don't put any bounds on the input, that ends up being O(log(k)n), where 'k' is largest sum. right, and the problem gets bigger as the value k is exponential in the input, so log(k) is actually in O(n) (strictly speaking you can't get to O(n^2) from this i guess, as the the number of digits and number of numbers trades off, but the k is hiding some stuff). beyond that you need O(k) space. e.g. taking the input where one elf carries 1 gigasnacks, a second 1 terasnacks, and a third 1 petasnacks (which in input would be written as just '1125899906842624'; n i still small) you start by allocating 1 petabits of memory, and then you need to scan *most* of the petabits to figure out the actually three largest numbers. one can probably get clever with encoding this sparsely, but i think one ultimately cycles back to this being a top-k extraction in that case. (this only for entertainment purposes of course, not at all obvious that the generalization should have elfs carrying trillions of snacks) Cybernetic Vermin fucked around with this message at 12:05 on Dec 2, 2022 |
# ? Dec 2, 2022 12:02 |
|
DrPossum posted:more like advent of chode
|
# ? Dec 2, 2022 12:53 |
|
Cybernetic Vermin posted:
This is so clearly the cleanest way to do this, given today's problems, that I'm kicking myself for missing it.
|
# ? Dec 2, 2022 15:30 |
|
LanceHunter posted:I feel a bit bad about all the switches and if statements in my code for day 2. I made a worse crime for part 2: couldn't be bothered to write another case analysis for the "what do I play such that the outcome matches what we're given" part so instead I brute forced it against all the three cases until I found the one that matched code:
|
# ? Dec 2, 2022 18:17 |
|
let's write code about elf calories - a statement people itt support
|
# ? Dec 2, 2022 22:56 |
|
DrPossum posted:let's write code about elf calories - a statement people itt support Advent of Code 2022.1 - We love our thicc elves
|
# ? Dec 3, 2022 03:05 |
|
well shart, I had been thinking about trying aoc again this year. guess I'll give it a go signed up as pancake-tongs
|
# ? Dec 3, 2022 03:33 |
|
Redid day 2 with the cleaner answer. Of course, then I post it here in spoilers and it still seems enormous compared to what everyone else is posting.code:
|
# ? Dec 3, 2022 04:00 |
|
not like we're doing code golf, for problem solving size doesn't matter a whole lot. especially my k nonsense will stop at all being a good idea before the end. nothing very interesting today, set intersections and a bit of ascii math, so having gotten properly into the mood for this i almost feel a bit cheated on the first weekend day of playing.
|
# ? Dec 3, 2022 08:21 |
|
so after knocking out today's aoc i figured i'd do something about vs code's nagging "hey we replaced the rust extension with a new one" notice and installed the new one. first thing i noticed was that it was flagging every use of text formatting macros as a missing-unsafe error. i looked around and saw something that suggested the fix was to update rust, so i did that. now it completely fails to compile anything because of some missing msvc library. very cool and easy-to-use language ecosystem!
|
# ? Dec 3, 2022 09:20 |
|
Cybernetic Vermin posted:not like we're doing code golf, for problem solving size doesn't matter a whole lot. especially my k nonsense will stop at all being a good idea before the end. I haven’t even felt the need to write something tail-call recursive yet. what a rip off.
|
# ? Dec 3, 2022 15:45 |
Jabor posted:so after knocking out today's aoc i figured i'd do something about vs code's nagging "hey we replaced the rust extension with a new one" notice and installed the new one. are you using rustup? this sounds vaguely familiar to some issue I remember having a couple years ago and it was because i had tried to install rust directly instead of using that. rust-analyzer, which is the new LSP that it sounds like you switched to, is also dependent on rustup iirc
|
|
# ? Dec 3, 2022 16:17 |
|
i was using rustup, yeah. i fixed it by installing visual studio 2022, which i guess the version of rust i updated to requires the build tools from?
|
# ? Dec 3, 2022 16:19 |
|
Rust enjoyers: as a newbie, can I ask if there's a better way to writecode:
All these casts suggest that the language would absolutely prefer that I not do this, but nothing more built-in lept out at me. (It feels like in general, in our new world of non-seven bit clean ASCII characters, this is a poor thing to do anyway, so maybe it's "fine" here and just "not fine" in a different context)
|
# ? Dec 3, 2022 17:01 |
|
|
# ? May 3, 2024 04:01 |
|
Dijkstracula posted:Rust enjoyers: as a newbie, can I ask if there's a better way to write i think the language is right and this is a thing to do only because it is an artificial programming problem. looks good to me.
|
# ? Dec 3, 2022 17:02 |