As 2023 Advent of Code is approaching fast, I thought I’d revisit my 2022 entries, and I realised a good focus would be to post one a day during November. No guarantees as to the quality of the algorithms used, but hopefully people will find the code readable and interesting. If anyone has questions...
A messy drawer? There should be at least two: one for the kitchen and one for general.
Visualisation
I wanted to get an idea of how the blocks were landing and here's some thoughts on what I came up with:
- they were building a simple maze (duh I guess).
- the final (blocking) block is highlighted as a tiny red dot for half a second or so (edit: now flashing!).
- my generated path jumped about seemingly at random even when blocks landed elsewhere so I don't animate the dropping of the first 1000 blocks as it's more noise than data.
- the ~500 blocks before the final one don't affect my path at all, so it's quite a boring end.
- Lemmy doesn't like long animations, so I skip 10 blocks at a time.
If you want to toast your CPU for a few seconds, here's some terrible Uiua code.
undefined
Data ← ≡◇(⊜⋕⊸≠@,)°/$"_\n_" &fras "AOC2024day18.txt" End ← 70_70 Count ← 1024 D₄ ← [1_0 ¯1_0 0_1 0_¯1] Valid ← ▽¬⊸∊:▽⊸(≡/××⊃(≤⊢End|≥0))+D₄¤ BestLen ← ⍣(-1⧻⊢path(Valid|≍End)0_0↙:Data|∞) Chop! ← ◌⍢(⨬(⊙◌+1|⊙⊙◌:):⟜^0⌊÷2+,,|>) BadBlock ← -1Chop!(=∞BestLen)Count ⧻Data Skip ← 1000 Step ← 10 Time
I’m reading some of these replies thinking I’m getting gaslighted by railway operator employees. Unless they actually sell “absolutely no sitting” tickets and the conductors fine abusers, this ticket makes no sense.
Tell everyone that I’ve just watched a Jordan Peterson video and I’m going down the rabbit hole and ask them if they know where I can get my hands on some ketamine. My irrational behaviour and urgent need for fast access to my funds would then seem pretty par for the course.
My CPU when I checked if part 1 code could solve part 2 (Day 11)
How to speak to aliens (or read Uiua code)
I've had a few comments on my Uiua solutions asking how you're even supposed to understand them, so I thought I'd write a little explainer.
Uiua is a new language that uses the array programming paradigm (other languages in this family are APL, J, K, R and BQN). This approach recognises that a great deal of programming is about the manipulation and interrogation of arrays of data and so provides tools to handle arrays of data as fundamental units. So rather than building nested for-loops to access data items, you manipulate the array as a whole, e.g. to add 1 to every element of a multi-dimensional array A, you would simply write +1A
. This approach not only makes some aspects of programming easier, it also means that the compiler can generate extremely efficient code, and in principle make use of massively parallel processes for further speedups (I don't know to what extent Uiua supports this). Array programming languages are very useful for people who want fast processing of larg
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
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)
Dad mode activated
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.
Requesting moderator status for adventofcode
The !adventofcode@lemmy.world community is currently without an active mod: the original creator does not seem to have been active on Lemmy in months. I PM’d them to check whether they were still interested in the community and have received no reply.
I'm presently more or less the only active poster there, though that may change next month when this year's Advent of Code kicks off.
he likes to larp in the words of a better man
That’s such a great description of this kind of tech-bro behaviour.
“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.”
True. I'm certainly at the point where quick jobs that I would have once done in Python quite often get done in Dart instead, avoiding the "context switch" of having to think in Python for that one task.
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.
I'm posting a daily Dart solution to last year's Advent of Code challenges
Hi all,
As many people here may already know, Advent of Code is an annual programming challenge that runs from 1st to 25th December each year where each day a new puzzle is published for you to solve. The puzzles ramp up in difficulty during the month and can test your familiarity with core computer science principles and algorithms.
As the title says, I'm currently going through my entries (written in Dart) to last year's challenge and rewriting them to run in your browser using DartPad. I'll be posting one a day until 25th November to the Advent of Code community on lemmy.world.
It's fairly quiet there at the moment, but I hope that with enough awareness of the community, it will liven up enough over the coming weeks that I don't have to go back to the other place for interesting discussions and hints next month!
Cheers, Michael
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.
Need more info
Go into your account settings (in Liftoff or the website) and switch “Show NSFW content” off. That will totally stop any NSFW-marked content from appearing in your feed
From reviewing the code it removes the transition animation when you click on an image to view it full screen (saving you 0.2 of a second). I think it was added when that animation wasn’t working correctly. Maybe it’s time to repurpose it now we’re actually seeing gifs being used a little more…
API call GetComments sometimes returns no comments
This happens for me on a small number of posts, and is generally repeatable, even when the website shows comments.
For instance, running on lemmy.world, GetPost(id: 290602) tells me the post exists and has 7 comments, as does https://lemmy.world/post/290602
But GetComments(postId: 290602) returns an empty list.
If I run against the original post on 'programming.dev', GetComments(postId: 99912) does show me the comments, but I don't think I'm supposed to be second guessing the federating logic :-)
Has anyone seen anything similar or can confirm they see this same behaviour for this post?
CHALLENGE: What is this thing?
It's about 10 cm (4") long. Metal and plastic.
Hopefully this will stump people a little longer than the other challenges have managed. What a naive fool I was! < 1 minute again...
If you do find the answer using Google Lens, hold onto it for a while to see if unaugmented humans can work it out :-)
Please add spoiler tags to any guesses to add to the element of suspense.
Hello geologists, can you help us confirm if we're seeing a fossil in the linked post?
[https://lemmy.world/pictrs/image/4654242d-e193-439e-9ff5-740c968a4772.jpeg] [https://lemmy.world/pictrs/image/0018aed8-56fa-48e1-8508-584aa0ed7082.jpeg]
We think it is, but it would be great if someone with a little more knowledge could post a more authoritative response in that thread.
This German pub has a secure storage system for your personal tankards
Sorry for the quality of the pic. Beer had been taken.
CHALLENGE: What is this thing?
Two white plastic discs that rotate freely, each with two semicircular arms which again rotate freely.
More pictures:
What is this thing?

Let us help you identify that mysterious object you’ve found. Currently in CHALLENGE mode: If you’ve got something obscure knocking about, post a picture, and let’s see how we do. Please prefix such posts with “CHALLENGE:” so we know we’ve got a fighting chance.

Got a thing? Want to know what it is? Ask the massed minds of "What is this thing?" for help!
https://lemmy.world/c/whatisthisthing
/c/whatisthisthing@lemmy.world
Currently in Challenge mode, so if you've got something you think will stump us, post it as a CHALLENGE.
CHALLENGE: What is this thing?
Just while the sub (group? community?) finds its feet, I thought it would be fun to post a few challenges. I'll be searching through my house for obscure objects, to see how obvious they really are...
So, what is this thing? Springy metal, about 5cm across, with rubbery sleeves on the two arms.
Sheep enjoying paddling in the river Rhine in Cologne
A local farmer pens their sheep up at various points along the meadows by the river over the summer, and yesterday they were enjoying having some access to the beach for a change.