What does “zoomed in to check which colour they re-used in the second chart so didn’t even realise there was a third one” count as?
What does “zoomed in to check which colour they re-used in the second chart so didn’t even realise there was a third one” count as?
Isn’t every video game just moving colourful blocks?
(Except Quake obviously)
It’s normally not so tricky on the first day, and the examples also normally do a much better job of guiding you away from wrong approaches so the increasing delay is intended to ensure you aren’t just spamming poorly tested answers.
The task in part two could be better written as “find the first occurrence of a digit in the string (either as a digit or as a word), and then separately find the last occurrence of a digit (either as a digit or as a word again) then compose these two digits”. Thinking of it like that should help you identify where your problem lies.
Dart solution
Here’s my solution to start the ball rolling. In the end I incorporated my part 1 answer into the part 2 logic, and golfed the code quite a lot.
import 'package:collection/collection.dart';
var ds = '0123456789'.split('');
var wds = 'one two three four five six seven eight nine'.split(' ');
int s2d(String s) => s.length == 1 ? int.parse(s) : wds.indexOf(s) + 1;
int value(String s, List digits) {
var firsts = {for (var e in digits) s.indexOf(e): e}..remove(-1);
var lasts = {for (var e in digits) s.lastIndexOf(e): e}..remove(-1);
return s2d(firsts[firsts.keys.min]) * 10 + s2d(lasts[lasts.keys.max]);
}
part1(List lines) => lines.map((e) => value(e, ds)).sum;
part2(List lines) => lines.map((e) => value(e, ds + wds)).sum;
I’m not sure that this link really helps your case, given these key points from the description:
The resolution by the British representative, Ambassador Sir Anthony Parsons
demanded an immediate cessation of hostilities between Argentina and the United Kingdom and a complete withdrawal by Argentine forces
Resolution 502 was in the United Kingdom’s favour by giving it the option to invoke Article 51 of the United Nations Charter and to claim the right of self-defence
Thanks for the fast action!
lemmy just doesnt show accurate numbers in local instances
Ah, I actually knew that but didn’t think of it when I was comparing them.
Thanks for the offer, I’ll catch up with you once I see what happens with this request.
I’ve been posting my solutions to last year’s challenge in the community, so skimming through those will give you a sense of the balance of fun and frustration.
There is a similar community on the programming.dev instance too but it has fewer subscribers and even less activity as is the way with far too many communities after the big wave died down.
Not sure what caused the downvotes here? Did the solution not work on some test data? Or did people hate the idea of me having more free time?
he likes to larp in the words of a better man
That’s such a great description of this kind of tech-bro behaviour.
Thanks, I’m not that familiar with Clojure, but I can read it okay. How fast did that run for you? I tried it in an online Clojure editor and it took more than 10 seconds for me, which from memory is comparable with my solution before I started hacking in some terrible shortcuts…
Haha, “Nadvent of Code” was just a joke description for my revisiting of last year’s challenges. It stands for “Not Advent of Code” or “November Advent of Code” depending on how the mood takes me. There’s a link to last year’s overview page on each post, and to the specific day on my more recent posts. Or you can just look at my solutions and figure out how you’d rewrite them in Rust. Have fun.
I first started going through my solutions from last year because I was intrigued by the interesting new language Uiua (pronounced wee-wuh) which is described as a “general purpose, stack-based, array-oriented programming language with a focus on simplicity, beauty, and tacit code.” (think APL meets FORTH!) But I soon realised that although I could solve some of the problems in Uiua, for others I don’t think a day will be long enough!
So it will be back to Dart this year with the goal of having every solution runnable in DartPad in well under one second, and ideally without having to search for hints online. I made it to day 19 last year before I got stumped; you’ll see more about that on Sunday!
“Hey baby, are you a compelling new novel? Because I’d love to lose myself in your sheets. Like sheets of paper, you know, pages. I’m sorry, I’ll leave now.”
Yes, when I did a search, I found I had a choice between two quite small and inactive communities, so I went for the slightly larger one. I’ll crosspost today’s post to that community see if it stirs up any more interest.
Yes, I really adopted it due to Flutter, but the dev team really are doing great work to make it a nice language, especially with version 3.
BTW, you will need to be careful to preserve the trailing whitespaces on the first few lines iof the testdata
string if you edit it, as my code lazily relies on it being there.
Oof. I got about 65% on the images I hadn’t seen in the post. I must be pretty close to being replaceable by an adversarial network.
We stayed in Sheerness (where this flight took place), and when my girlfriend saw this she immediately asked “Did pigs fly before women did?”. And the answer turned out to be no, women beat pigs by two weeks: “Sarah Van Deman … was the woman who flew with Wilbur Wright on October 27, 1909” source