|
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. Today was a good lesson in typing time vs computer time for overall efficiency. I did another hash table for the scores for each letter, rather than doing the ascii math (since upper-case and lower-case letters would have needed different arithmetic). Of course, the time I took typing that was ages in comparison to the zillionth of a second saved avoiding the one extra comparison.
|
# ? Dec 3, 2022 17:04 |
|
|
# ? May 2, 2024 21:02 |
|
You can cast your input character into a u8, and then compare it against byte literals like b'a'. I just wrote the obvious code with one if statement checking if it was between a and z, and a second one for A and Z - but since those are the only two ranges in the problem you could instead just check if it's greater than Z and assume lowercase if so.
|
# ? Dec 3, 2022 17:29 |
|
part of the reason im excessively invested in aoc this year (and to some extent last) is i am teaching a competition-coding based course. over the years the first year of cs has been taken up with more and more theory, collaboration, documentation, and communication skills. which is very good, but students have gotten noticeably worse at just knocking out a program that does a thing independently. which gives me the luxury to just push problem-solving where you just quickly do something sufficient. which was like 90% of the program when i was a kid, and i think is fun, but is actually kind of needed now. not like you can be dumb doing it, but it is very much core to ignore small inefficiencies if it is good enough to get a thing done. e: to be clear i am 100% a scrub noob at this stuff, struggling to make it through. and everyone working primarily to pay bills and live should be. but it is good to do a bit of an exercise to make sure you can still make the computer do what you need it to without it being too major a undertaking. Cybernetic Vermin fucked around with this message at 18:10 on Dec 3, 2022 |
# ? Dec 3, 2022 17:30 |
|
I like writing code that doesn't have to come out looking professional for a changecode:
|
# ? Dec 3, 2022 17:33 |
|
Cybernetic Vermin posted:part of the reason im excessively invested in aoc this year (and to some extent last) is i am teaching a competition-coding based course. over the years the first year of cs has been taken up with more and more theory, collaboration, documentation, and communication skills. which is very good, but students have gotten noticeably worse at just knocking out a program that does a thing independently. A couple of years ago I got assigned to teach a weird vestigal "unix scripting" course and it was pretty awesome to see the students who totally floundered at the start by not being able to deal with an empty editor finish the class being able to be all "oh, sure, a program that does X? Ok, bing bang boom"
|
# ? Dec 3, 2022 18:13 |
|
not sure whether this belongs here or in the cyberpunk thread, but: https://www.reddit.com/r/adventofcode/comments/zb98pn/2022_day_3_something_weird_with_copypasting/ quote:I wasn't aware that "input corruption due to cryptocurrency malware" was an option on my AoC 2022 Moderation Topics bingo card... wow.
|
# ? Dec 3, 2022 18:28 |
|
Dijkstracula posted:not sure whether this belongs here or in the cyberpunk thread, but: https://www.reddit.com/r/adventofcode/comments/zb98pn/2022_day_3_something_weird_with_copypasting/ oh wow
|
# ? Dec 3, 2022 19:25 |
|
more neat day3 news https://twitter.com/ostwilkens/status/1599026699999404033 this guy used GPT-3 ML model and managed to submit an ai-generated solution to the silver-star problem in 10 seconds. seems like he is just using OpenAI's api so he didn't train it himself or anything only second place for the gold star though is that in the spirit of competition? RPATDO_LAMD fucked around with this message at 20:44 on Dec 3, 2022 |
# ? Dec 3, 2022 20:37 |
|
got caught up on these this morning. I've been using python but I'm tempted to give it a shot with rust or zig depending on if I feel like learning something impractical or very impractical
|
# ? Dec 3, 2022 21:39 |
|
Three days down and haven't encountered any compiler bugs yet. Don't remember how far I got in 2018, but I remember finding plenty of bugs then.
|
# ? Dec 3, 2022 21:42 |
|
Athas posted:Three days down and haven't encountered any compiler bugs yet. Don't remember how far I got in 2018, but I remember finding plenty of bugs then. futhark is real good in my experience. gl, i fear a smaller part than is realistic will turn out amenable to the optimizations relevant. Cybernetic Vermin fucked around with this message at 10:31 on Dec 4, 2022 |
# ? Dec 3, 2022 23:25 |
|
Dijkstracula posted:not sure whether this belongs here or in the cyberpunk thread, but: https://www.reddit.com/r/adventofcode/comments/zb98pn/2022_day_3_something_weird_with_copypasting/ That's a hell of a way to discover that your system was compromised.
|
# ? Dec 4, 2022 02:54 |
|
DrPossum posted:more like advent of chode
|
# ? Dec 4, 2022 10:05 |
|
day 4: first off-by-one of the year. also wrote a real dumb program, in that i realized the ranges, speculatively guessing that it'd be needed for part 2.Dijkstracula posted:This sounds super-cool; is the material available publicly anywhere? not yet, first year had a lot of flaws (as it always goes), but hopefully down the line!
|
# ? Dec 4, 2022 10:32 |
|
Cybernetic Vermin posted:futhark is real good in my experience. gl, i fear a smaller part than is realistic will turn out amenable to the optimizations relevant. Thanks for the kind words. It's getting more tricky to do the input parsing, but not so bad yet: pre:def parse (s: string[]) = let (get,ls) = lines.lines s in map (\l -> let (a,b) = span (==',') (get l) let (a0,a1) = span (=='-') a let (b0,b1) = span (=='-') (tail b) in ((atoi a0, atoi (tail a1)), (atoi b0, atoi (tail b1)))) ls
|
# ? Dec 4, 2022 13:48 |
|
day 4 status: inclusive intervals Athas posted:Thanks for the kind words. It's getting more tricky to do the input parsing, but not so bad yet: code:
|
# ? Dec 4, 2022 18:11 |
|
I'm finding itertools::collect_tuple and array_init::from_iter to be pretty handy for writing this sort of code with less actual writing.
|
# ? Dec 4, 2022 23:21 |
|
As it happens I learned about itertools::from_tuple today, and used for part 2 of today's! A habit I've been getting into is to solve the problem and look at fasterthanlime's solution, and I usually learn at least one useful idiom from it even if his solutions are a lot more "built-out" than mine.
|
# ? Dec 5, 2022 00:58 |
|
Like a bunch of other people ITT I like to use Advent as an excuse to learn new languages. This year it's Factor. I'm pretty happy with this day 4 solution:code:
It's taking me a bit to get my head back into the concatenative programming groove, I haven't used Postscript in over a decade and Factor has a shitload of libraries, many of which are conceptually similar to stuff I'm already familiar with from Rust or Clojure but often with different names.
|
# ? Dec 5, 2022 01:24 |
i found it kind of odd how easy today's part 2 was in comparison to others, all i had to do was swap out a couple variables from what i did for part 1. i'm doing c++ this year. i've been wanting to learn how to write vst audio plugins for years but i've always been working in plangs/Java (other than loving around with Rust a bit in my spare time for the past year or so) so the task of learning c++ has always kind of put me off from that. so far at least it hasn't been as bad as i'd thought it would be
|
|
# ? Dec 5, 2022 04:32 |
|
c++ isn’t and won’t be that bad for any advent of code stuff you do. once the code base starts growing larger than toy project though it gets hairy quick
|
# ? Dec 5, 2022 04:38 |
|
Another kinda underwhelming part 2 on day 5.
|
# ? Dec 5, 2022 07:11 |
|
MrQueasy posted:Another kinda underwhelming part 2 on day 5. maybe they're harder to implement in other languages but for my day 4 and day 5 I was able to get the second star in about 10 seconds by just changing one predicate
|
# ? Dec 5, 2022 07:13 |
|
I will say that today’s exercise was another chance to consider the philosophy of how to handle the input. I ended up just typing up the 2d array for the crate stacks, then only saved the moves to the input file that the program parsed. Taking all of it as a single input file and properly parsing it into the two different types of data within would have been an interesting exercise, and I may do that later today if work is slow. As far as the second stars being easy, it does kids feel that way. I’m sure something will come along in the next week or so that makes me regret saying that, though.
|
# ? Dec 5, 2022 07:43 |
|
LanceHunter posted:I will say that today’s exercise was another chance to consider the philosophy of how to handle the input. I ended up just typing up the 2d array for the crate stacks, then only saved the moves to the input file that the program parsed. Taking all of it as a single input file and properly parsing it into the two different types of data within would have been an interesting exercise, and I may do that later today if work is slow. It just feels like an unusually non-twist of a twist compared to previous years' week 1 part 2s.
|
# ? Dec 5, 2022 09:15 |
|
it was enough of a non-twist that reading sloppily i wound up writing part 2 first.
|
# ? Dec 5, 2022 09:41 |
|
It feels like that in past years part 1 was a "parse this input and here's a trivial challenge to see if you've parsed it correctly", and part 2 was an actual problem that needed you to do something with that parsed input. This year they feel like two trivial challenges that just happen to have the same input. Hopefully it picks up at some point.
|
# ? Dec 5, 2022 10:57 |
|
Today was the first mindlessly sequential implementation (except the input parsing I guess). I have a hunch that the second part can be parallelised by characterising a movement as a linear operation and then taking their composition, but these are supposed to be simple challenges and I have a real job too.
|
# ? Dec 5, 2022 11:49 |
|
Jabor posted:It feels like that in past years part 1 was a "parse this input and here's a trivial challenge to see if you've parsed it correctly", and part 2 was an actual problem that needed you to do something with that parsed input. real early days yet, so pretty hopeful. i kind of expected something more substantial sunday (as the weekends are traditionally larger), but day 4 might have been a bit too early to do that. not going to lie though, it has been a *bit* flat so far. compare e.g. day 5 of last year which was this (somewhat annoying, but a bit different) thing: but then it was a weekend problem.
|
# ? Dec 5, 2022 12:13 |
|
i don't think day five last year was particularly twistier than today. i looked up my answers and the difference was changing the inner bit like thiscode:
code:
|
# ? Dec 5, 2022 15:34 |
|
Destroyenator posted:i don't think day five last year was particularly twistier than today. i looked up my answers and the difference was changing the inner bit like this That's a good point. The actual code updates needed to handle the way Part 2 changes the problem can be quite small, because figuring out the change you need to implement is more important than doing a lot of separate work. Hell, maybe the problem just feels easier for some folks this year because they've gotten better at computer?
|
# ? Dec 5, 2022 15:44 |
|
I wondered if some data scientist at Advent Of Code, LLC looked at the dropoff and decided they needed to make it gentler so 90% of people don't quit in the first week
|
# ? Dec 5, 2022 15:57 |
|
it's also just hard to write puzzles that target a specific difficulty/experience level, like for day 5 I bet the puzzle writer thought people would want to simulate each individual crate's movement instead, which would make implementing part 2 a little more complex
|
# ? Dec 5, 2022 16:14 |
|
I does feel easier than previous years, but: (a) I'm probably comparing the current point to whatever point I dropped out at in previous years (b) I have, hopefully, gotten at least slightly better at computer, and (c) the last three years have been incredibly stressful, the last three months at work have piled more stress on top of that, I'm staring down the barrel of a holiday where I'll be expected to travel for hours on icy country roads so that I can pretend to be normal around my dysfunctional in-laws, and if AoC wants to take it easy on me this year so I can relax with a new language I am a-ok with that.
|
# ? Dec 5, 2022 16:25 |
|
Dijkstracula posted:I wondered if some data scientist at Advent Of Code, LLC looked at the dropoff and decided they needed to make it gentler so 90% of people don't quit in the first week Lol this is a labor of love by one dude (Eric Wastl), 5 beta testers, and 2 community managers.
|
# ? Dec 5, 2022 18:05 |
|
still, no doubt a lot of tuning with such things in mind. which is v. good, id hate them tuning it for the true tryhards. it is absolutely fine so far this year. not looking for higher difficulty, but would enjoy a bit more of a curveball theme next. i cited day 5 last year not because it was hard or had a twist, but because it is one of those you absolutely can ponder a moment and do in several different ways (would have worked even better this year with the preceding overlapping ranges one).
|
# ? Dec 5, 2022 18:10 |
|
man i am still struggling with types in rust i have an array of vectors that i hand instantiate from the puzzle input because parsing all that in code will be a huge pita i then have a loop for each line that pulls out the number of crates to move, the source and target stacks, and then i just push into the target vector what i pop from the source. it then does that x times however i'm getting an error that it can't infer the type and after an hour of googling around i still can't figure out how it actually wants me to specify this for the compiler code:
halp edit: oh i'm dumb it was complaining about the index type, not the pop/push PIZZA.BAT fucked around with this message at 21:43 on Dec 5, 2022 |
# ? Dec 5, 2022 21:41 |
|
it's sloppy but i solved part two by just creating a temp vector to pop the source stack into and then turning around and popping them all into the target stack afterwards. i definitely could have done this with an elegant slice somehow but i'm struggling enough just with rust's enum/typing system for now so f it edit: maybe someone can help me understand this because these are the lines that i was struggling with code:
i originally had the pop and push in the same line. everything to the right of the assignment was inside the next line's push. rust wasn't liking this because i guess it allowed for ambiguity but i just couldn't figure out how to tell it 'hey whatever is here should be a char'. i eventually gave up and split it into the two lines you see above but i'd like to know how to get this down to a single line PIZZA.BAT fucked around with this message at 22:42 on Dec 5, 2022 |
# ? Dec 5, 2022 22:39 |
|
that sounds like an issue with lifetimes and not types to me cus the types there are pretty dang trivial, but usually rust compiler errors are very detailed about what the problem is
|
# ? Dec 5, 2022 23:24 |
|
|
# ? May 2, 2024 21:02 |
|
This is the first year I've done advent of code, and so far I'm having an absolute blast. Parsing today's input was really fun, and people are REALLY mad about it in some circles.
|
# ? Dec 5, 2022 23:34 |