cacheson

joined 1 year ago
[โ€“] cacheson@kbin.social 1 points 9 months ago* (last edited 9 months ago) (1 children)

Nim

Another tough one. Judging by the relative lack of comments here, I wasn't the only one that had trouble. For me this one was less frustrating and more interesting than day 12, though.

I solved part 1 by doing a recursive depth-first search, biasing towards a zigzag path directly to the goal in order to establish a baseline path cost. Path branches that got more expensive than the current best path terminated early. I also stored direction, speed, and heat loss data for each tile entered. Any path branch that entered a tile in the same direction and at the same (or greater) speed as a previous path was terminated, unless it had a lower temperature loss.

This ran pretty slowly, taking around an hour to finish. I took a break and just let it run. Once it completed, it had gotten pretty late, so I did a quick naive modification for part 2 to account for the new movement restrictions, and let that run overnight. The next day it was still running, so I spent some time trying to think of a way to speed it up. Didn't really get anywhere on my own, so I started reading up on A* to refresh my memory on how it worked.

The solution that I arrived at for the rewrite was to use Dijkstra's algorithm to pre-compute a map of what the minimum possible costs would be from each tile to the goal, if adjacent tiles could be moved to without restriction. I then used that as the heuristic for A*. While I was writing this, the original part 2 program did finish and gave the correct answer. Since I was already this far in though, I figured I'd finish the rewrite anyway.

The new program got the wrong answer, but did so very quickly. It turned out that I had a bug in my Dijkstra map. I was sorting the node queue by the currently computed cost to move from that node to the goal, when it instead should have been sorted by that plus the cost to enter that node from a neighbor. Since the node at the head of the queue is removed and marked as finalized on each iteration, some nodes were being finalized before their actual minimum costs were found.

When using the A* algorithm, you usually want your heuristic cost estimate to underestimate the actual cost to reach the goal from a given node. If it overestimates instead, the algorithm will overlook routes that are potentially more optimal than the computed route. This can be useful if you want to find a "good enough" route quickly, but in this case we need the actual best path.

[โ€“] cacheson@kbin.social 3 points 9 months ago* (last edited 9 months ago)

Nim

I'm caught up!

This one was pretty straighforward. Iterate through the beam path, recursively creating new beams when you hit splitters. The only gotcha is that you need a way to detect infinite loops that can be created by splitters. I opted to record energized non-special tiles as - or |, depending on which way the beam was traveling, and then abort any path that retreads those tiles in the same way. I meant to also use + for where the beams cross, but I forgot and it turned out not to be necessary.

Part 2 was pretty trivial once the code for part 1 was written.

[โ€“] cacheson@kbin.social 2 points 9 months ago

Nim

Almost caught up. Not much to say about this one. Part 1 was a freebie. Part 2 had a convoluted description, but was still pretty easy.

[โ€“] cacheson@kbin.social 2 points 9 months ago

Nim

Getting caught up slowly after spending way too long on day 12. I'll be busy this weekend though, so I'll probably fall further behind.

Part 2 looked daunting at first, as I knew brute-forcing 1 billion iterations wouldn't be practical. I did some premature optimization anyway, pre-calculating north/south and east/west runs in which the round rocks would be able to travel.

At first I figured maybe the rocks would eventually reach a stable configuration, so I added a check to detect if the current iteration matches the previous one. It never triggered, so I dumped some of the grid states and it became obvious that there was a cycle occurring. I probably should have guessed this in advance. The spin cycle is effectively a pseudorandom number generator, and all PRNGs eventually cycle. Good PRNGs have a very long cycle length, but this one isn't very good.

I added a hash table, mapping the state of each iteration to the next one. Once a value is added that already exists in the table as a key, there's a complete cycle. At that point it's just a matter of walking the cycle to determine it's length, and calculating from there.

[โ€“] cacheson@kbin.social 1 points 9 months ago

Nim

This one was a nice change of pace after the disaster of day 12. For part 1 I kept a list of valid column indexes, and checked those columns in each row for reflections, eliminating columns from the list as I went. To find vertical reflections, I just transposed the grid first.

Part 2 looked daunting at first, but I just needed to add a smudges counter to each column candidate, eliminating them when their counter reaches 2. For scoring, just count the 1-smudge columns.

[โ€“] cacheson@kbin.social 22 points 9 months ago

I love these memes that turn into threads full of vim tips. You really can do anything within vim. You can even exit vim!: !killall vim

[โ€“] cacheson@kbin.social 2 points 9 months ago (1 children)

Huh, I'm going to have to try that at some point. It's even got nim support.

Link for the lazy

[โ€“] cacheson@kbin.social 1 points 9 months ago

Oh wow, I guess it doesn't take too much. I copied your survey post over to r/nim with a "cross-posted from nim@programming.dev" link, and also invited the author of Enu to post here. I'll keep at it.

[โ€“] cacheson@kbin.social 1 points 9 months ago

Alright, not a bad idea.

[โ€“] cacheson@kbin.social 3 points 9 months ago

I imagine they'd also want to have something you can click that shows how many votes were local, how many were from other instances, how many were blocked, etc.

Actually, that would be really cool and worth doing regardless. Have a voting statistics view for each post where upvotes and downvotes are broken down per instance, and maybe by other criteria too. @ernest

 

I wrote a new script script that scans an arbitrary block of text for URLs, and extracts any hostnames that aren't already on the big list or in a new ignore list file. I ran the data from sub.rehab and redditmigration.com through it, and found 6 new instances to add to the list:

Topic/audience focused:

  • seemel.ink - "See Me Link Aggregator" - Tech, mostly keyboards
  • awful.systems - Tech snark?
  • discuss.ntfy.sh - "ntfy (pronounced notify) is a simple HTTP-based pub-sub notification service. You can use it to send push notifications to your phone via HTTP PUT/POST."
  • fedi196.gay - LGBTQ-focused kbin instance
  • rimworld.gallery - "Rimworld.gallery is a non profit kbin server dedicated to Rimworld, especially high resolution renders made with the progress renderer mod."

Location/language focused:

  • Portuguese - lemmy.pt - "A public instance of Lemmy dedicated to the entire Portuguese-speaking community."

The ignore list may also be kind of interesting to look at. I tried to categorize non-threadiverse sites by what software they're running, in case said software ends up implementing ActivityPub in a way that's compatible with lemmy and kbin.

 

There's currently a spam "buy adderall" post on /m/fediverse that's been up for 16 hours now. The magazine has no moderators other than Ernest.

I also remember hearing at some point that kbin.social was being run by some other admins so that Ernest could focus on code, but I don't know who they are. Does anyone else know who we should be pinging for issues like this?

One additional question, is there an issue tracker for problems/requests that are specific to kbin.social, rather than the kbin codebase? It doesn't make sense to fill up the issue tracker on codeberg with "this magazine needs moderators" requests and the like, but we do need somewhere to keep track.

3
submitted 1 year ago* (last edited 1 year ago) by cacheson@kbin.social to c/MagHub@kbin.social
 

Edit: Lemmy-style link doesn't seem to work? Here's how this post looks from lemmy.world. Here's a relative link for Lemmy users:

114
me_ir ule (media.kbin.social)
 
 

This place is looking a bit dead. It seems like lemmy.world has the most active Bitcoin community, so we should probably consolidate our activity there:

 

This got created on programming.dev about 2 weeks ago, but hasn't had much activity yet. Not too surprising as Nim is a relatively new language. It's super cool and you should check it out, though. It's a compiled language with performance similar to C/C++, but is much more pleasant to work in. Some tend to liken it to working with Python.

 

Just found a place to post my more risque anime memes. It has a "no genitals" rule, so not for outright porn:

 

I just made a very large update to the list of specialized instances. It's now about 3 times the size! I normally won't be making new posts here for updates, but this was a really big one:

 

I went through all the instances listed on lemmyverse.net and added almost all of the specialized ones I found. The list is about 3 times as large now! Definitely getting Old Web vibes. Is it time to start making webrings again?

Here's the additions:

Topic/audience focused:

  • disflux.org - "disflux is a lemmy instance focused on D.I.Y. and self sufficiency type communities."
  • lemmyadmin.site - "A Federation of small instance administrators to share knowledge and back each other up during off hours incidents."
  • community.nicfab.it - "This is a community space for projects and users interested in privacy, data protection, cybersecurity, and innovative solutions."
  • hobbit.world - "This is intended to be a small community of folks who love the works of Tolkien."
  • lemmydeals.com - "A Federated deal finder"
  • code4lib.net - "GLAM themed online community" (galleries, libraries, archives, and museums)
  • zoo.splitlinux.org - "Everything Split Linux"
  • lemmy.srv.eco - "Self-sufficiency, mutual aid, collapse, and other subjects related to the environment and our place and role(s) within it."
  • support.futbol - "Association Football focused instance."
  • digipres.cafe - "A community notice board and discussion space for all things digital preservation, including digital-GLAM, and digital information records management."
  • neatia.xyz - "dedicated to writing and sharing prompts for prompt engineering in LLMs."
  • thevapor.space - "Vaping and engineering discussion space"
  • lemmy.glasgow.social - "A place for communities based in and around Glasgow, Scotland."
  • mobilemmohub.com - "Community of mobile MMO games enthusiasts"
  • lemmy.graphics - "A Lemmy instance for computer graphics hobbyists and professionals."
  • lemmymemes.com - "Join our online board, connect with meme lovers, and unleash your laughter. Share, discuss, and enjoy the funniest memes around. It's meme time!"
  • lemmy.piracy.guide - "Piracy Guide Lemmy"
  • demotheque.com - "For the demoscene, culture and people associated with it."
  • tagpro.lol - "lemmy instance for tagpro players"
  • citizensgaming.com - "a Star Citizen specific Lemmy instance"
  • frmsn.space - "The home for Freemasonry on Lemmy & the Fediverse"
  • discuss.divergentparenting.space - "A space for caregivers of neurodivergent people to talk amongst themselves and provide support. Allies are welcome."
  • lemmy.bringdaruck.us - "A home for all things hiphop"
  • oceanbreeze.earth - "A nature themed community for adventurists."
  • dit.reformed.social - "a space for Reformed Christians to have discussions, make friends, and support one another"
  • linux.community - "The Linux.Chat community is a multi-platform community for general Linuxยฎ support."
  • lemmy.wraithsquadrongaming.com - "Star Wars is a buffet - there's something for everyone!"
  • lemmyf.uk - "your nsfw homepage"
  • lemmy.kodemystic.dev - "Extradimensional pit for eschatonic oracles, anarcho-technomancers, wasted tinfoil madhatters, seekers of eldritch abysses and amnesiac xenomorphs."
  • lemmy.servarr.com - "Lemmy for Servarr and all arr related things"
  • l.cackl.io - "Link aggregation for furries: hyenas and hyena friends, specifically! Furry content not required."
  • femboys.bar - "lemmy instance for the bois'"
  • moto.teamswollen.org - "For all motorcycle discussions including racing."
  • lemmy.beyondcombustion.net - "A Lemmy community for cannabis, vaporizers, and vaporizer accessories."
  • boomer.casino - "the only website in the fediverse made for the digital elderly" (memes)
  • tabletop.place - "A home for board games, tabletop games, wargames, and role-playing games!"
  • lemmy2.addictmud.org - "focus on gaming in general, mudding more specifically, and my mud exactly (addictMUD)."
  • fanexus.com - "A lemmy instance devoted to fans of all kinds."
  • gekinzuku.com - "The best gaming site ever"
  • lemmy.kde.social - "Friendly lemmy instance for the KDE community"
  • lemmy.redkrieg.com - "Just a place for makers to post their things!"
  • shinobu.cloud - "For Shinobu and Anime lovers"
  • toons.zone - "A space for all things animation of all mediums, whether youโ€™re just a fan, or an artist yourself."
  • lemmy.vrchat-dev.tech - "a community-driven lemmy instance for VRChat, a virtual universe home to thousands of unique worlds!"
  • lemmy.spacestation14.com - "A Lemmy instance for Space Station 14"
  • wallstreets.bet - "a hedge against an eventual elimination and removal of the original /r/wallstreetbets"
  • lemmy.linuxuserspace.show - "This instance is brought to you by the guys that do the Linux User Space video and audio podcast."
  • aiparadise.moe - "a Lemmy instance focused on all things AI, everyone is welcome here :)"
  • crystals.rest - "A general instance for livestreaming, anime, and retro art!"
  • odin.lanofthedead.xyz - "for LANoftheDead network members and other likeminded human beings."
  • wizanons.dev - "for wizards, witches, warlocks, and all magic users. LGBTQIA+ friendly. All welcome! Mysticism and psychedelics welcome too."
  • lemmyfly.org - "A Lemmy instance with aviation related communities"
  • lib.lgbt - "positive and welcoming lemmy community with a particular focus on LGBT people and their allies."
  • lemmy.4d2.org - "A general purpose instance with an affection for retrocomputing and a left-libertarian cypherpunk sensibility."
  • psychedelia.ink - "for all things psychedelia or psychedelia-adjacent."
  • terefere.eu - "Arts & history instance. Everyone is welcome!"
  • possumpat.io - "An instance hosting communities for some niche interests and hobbies."
  • yiffit.net - "A queer and yiffy lemmy instance for furry art discovery"
  • lemmy.zip - "A Lemmy community for everyone, with a focus towards tech, PCs, and gaming."
  • lemmy.villa-straylight.social - "A general purpose Lemmy instance with a cool cyberpunk aesthetic"
  • lemmy.dbzer0.com - "Communities about Generative AI, Copylefts, Neurodivergence, Filesharing, and Godot Engine software"
  • lemmy.blahaj.zone - "a general purpose lemmy instance for queer and gender diverse folk, and their allies."
  • pawb.social - "Communities for furries by furries"
  • libreauto.app - "Libre Automation: Build Smart Homes, Liberating with Open-Source"
  • lemmy.design - "A Lemmy community for tech and design"
  • communick.news - "Given that Communick is a privacy-focused service provider who supports open source and the indieweb, you can expect some of this content to gravitate towards that"
  • lemmy.intai.tech - "Integrated AI - Home and forum for AI Enthusiasts" Front end broken? Doesn't list any posts, but direct links to them still work
  • lemmy.zip - "A Lemmy community for everyone, with a focus towards tech, PCs, and gaming."

Location/language focused:

(For some of these it's a little unclear to me whether they should be associated with a country or a language. Please let me know if anything needs to be corrected.)

view more: โ€น prev next โ€บ