Hacker News new | past | comments | ask | show | jobs | submit login
Advent of Code on the Nintendo DS (sailor.li)
201 points by zdw 3 months ago | hide | past | favorite | 52 comments



Oh. I wrote this post. I didn't expect it to make a second round here.

I'll elaborate on anything in here if anyone wants to know things.


Just wanted to let you know I really thoroughly enjoyed this writeup, and I very much hope you get around to part 2 with input et al.


Third time in 24 hours. I still don't understand how HN works for repeat submissions. Regardless, happy to see it get traction.


I think certain timings are more likely to get a post to the top and if the mods deem the content valuable, and the submissions aren’t all by a single user, they allow it.


It's far more complicated than that


Break it down for me.


Magnets


> Every Nintendo handheld up to the 3DS contains a GameBoy inside it!

I think this was quoted from elsewhere within the post but, is this true? If by "up to" we're not including the 3DS, the DSi and DSi XL still don't contain a GBA slot. I don't _think_ they contain the hardware either b/c with homebrew I believe the GBA games are emulated on those newer devices.

Am I mistaken here?


The Nintendo 3DS (and DSi too) contain a version of the ARM7TDMI CPU used in the Game Boy Advance [1]. On the 3DS, this chip was used for the Game Boy Advance Ambassador titles [2], which effectively run "natively" on the 3DS - when launching a game, the 3DS reboots into a different firmware and just runs the GBA game.

Later, homebrew was able to sideload GBA titles [3], which essentially has perfect software compatibility. However, emulating GBA titles still has advantages over rebooting the device so software emulators are available for the 3DS. The New 3DS is fast enough to provide pretty high quality GBA software emulation.

I don't think a similar path to directly use the DSi's ARM7 to boot GBA games was ever found by homebrewers (it may just be that the DSi is not able to reboot in a "different mode", which Nintendo did release for the 3DS?). The best available on the DSi seems to be a "compatibility layer" solution that tries to run the ARM7 code on the main ARM9 CPU [4], which seems to work surprisingly well.

[1]: https://www.3dbrew.org/wiki/ARM7_Registers

[2]: https://nintendo.fandom.com/wiki/Nintendo_3DS_Ambassador_Pro...

[3]: through "Virtual Console injection" tools, or through https://github.com/profi200/open_agb_firm

[4]: https://emulation.gametechwiki.com/index.php/GBARunner3


> it may just be that the DSi is not able to reboot in a "different mode", which Nintendo did release for the 3DS?

From GBATEK:

"The memory regions and IRQ bits do still exist internally, but the DSi does basically behave as if there is no GBA cartridge inserted. Reading GBA ROM areas does return FFFFh halfwords instead of the usual open bus values though."

Since the memory map isn't flexible and GBA games expect to load data from the cartridge at the hardcoded area, games won't function on the ARM7. I assume the 3DS has special hardware to handle this properly.


I'm such a baby programmer that Advent of Code is still challenging for me, so it's fascinating to see people taking it and exploring all these new languages and platforms. I found (and subsequently lost) someone who had started creating little 8-bit style visualizations from the data outputs.

I do feel like programmers are a bit of a masochistic lot when it comes to AoC, though.

> The logical way to output the solution for the AoC problem is to create sprites for every digit, upload them to video memory, and arrange the sprites on screen. I'm not going to do that and instead I will use Display Mode 2...


Don't beat yourself up.

This guy - "I do actually know Rust, but I never learned how to use it. I just started writing it because I was born with an innate knowledge of the language, similar to how I know Java or Kotlin despite never having learned them."

My first words were "Dada!". This guys was "public static void main(String[] args)"


There’s a breed of programmers around who just like making things harder for themselves, and are somehow good at it. It’s like being a competitive power lifter or something like that. More weight, more weight, and at some point you get excited by more weight.


You could also compare programming to riding a bicycle - almost anyone can learn how to do that. So, if you want to stand out, you have to ride a unicycle (=Rust) on a tightrope (=the Nintendo DS)...


Not only that, he's also a child prodigy, because (depending of the edition of Rust that was implanted into his brain at birth) he can be at most 12 years old? I am however told that the early versions had little to do with the current version, so having one of those hardwired in your brain would be more of a hindrance than help...


It's more like Rust 2018 was sent back in time 18 years and implanted as latent circuits into my head.


Don't beat yourself up so much, it's challenging to the majority of developers.

The article itself sums things up well "Most of the puzzles are in the realm of either string processing (somewhat applicable to programming), logic puzzles (not really applicable to most programming), or stupid gotchas in the input format (annoyingly, very applicable to most programming)."


The largest challenge is in having enough energy after work to sit down and start coding again.


I really feel this one, it's hard for me to work on personal projects after a long day at work


To be fair, when I look at my private leaderboards the only seriously committed individuals seem to be either 10x devs or unemployed.


Yeah I only ever get started after I've been on holiday for a bit.


Senior developer here, it is challenging. It's designed to be. I'm to the point now though that im a bit burnt out on it. I miss a weekend and then don't have a desire to catch up.


I used to do like 20 days or so in uni, but now I just wish it was in any other month but December - it's just impossible to find the time with all the year-end tasks and ceremonies.


This. December is already a very intense month, and carving out time each day to solve the problems becomes increasingly difficult.


I’ve thought the same in past years but for last year’s aoc I didn’t try to finish all the puzzles in December and let myself work on them whenever I had time throughout the year. It’s a bit less fun because the general zeitgeist isn’t focused on it outside of December but still totally possible to finish them at your own pace.


I want to say - the difference between baby programmer and guy (?) like OP is experience.

I don't directly have experience with hacking on DS, but I had some experience with embedded programming. It first seems daunting and hard, and then you do some stuff and read example code and other code on github and you become "wait that's it?"

What seems hard becomes easy by actually doing it. (that means you need to have time, too, which is another thing)


> I do feel like programmers are a bit of a masochistic lot when it comes to AoC, though.

Maybe. But for some it's really just the enjoyment of a good challenge that lets them explore and try out things. I personally love hardware like the DS simply for its accessibility. Modern PCs and consoles are way too complex, while the DS allows you to poke at its guts with no OS or virtualization in the way. It's fun to approach problems like those in AoC in completely novel ways on systems that require and allow you to do things differently.

It's not for everyone, sure, but it's certainly not torture for those who do it.


The last few days (which more difficult) are still challenging for me, a lot of the difficulty is also just intentionally confusingly described problems I find


There are no AoC problems that are "intentionally confusingly described" and I think the creator would take offense to you saying that.


I didn't know there were AoC sicophants too (I thought only rust had those), let me rephrase it for you "intentionally misleading or vague problem descriptions to add to the challenge" better? Or are still offended by my opinion?


> "intentionally misleading or vague problem descriptions to add to the challenge" better?

No, it's not better. The creator puts a lot of effort and user testing into making the problems as clear and specific as possible, and has given talks on that exact subject. There's absolutely nothing "intentional" about any difficulties you have understanding the problem text. Unfortunately there's only so much that can be done for people who simply can't read.

> Or are [you(?)] still offended by my opinion?

I never said that I was offended, I said that the creator would take offense to your accusation. I'm noticing a pattern here.


Fun read! I just missed doing professional gamedev on the DS/DSi (made a few for 3DS), but we still had a Nitro devkit or two in the office. But my experience is of course very different since we both used C++ and had all the official docs and kits. So it's fun to see people reverse engineering it.

There was definitely something fun with making games for these very specialized and unique consoles. While it's natural and a whole lot easier to dev now that all consoles (and PCs) have converged to being almost identical, I can't help but feel a bit nostalgic for it.


Cool! I've coded for the Gameboy Advance in the past, it's very fun to write software for well-documented and feature-rich hardware that also have rock solid debugging tools.

By picking the DS, the author might also have ensured his application will work hundreds of years from now...


Thanks article for teaching me about BlocksDS! Looks somewhat more healthy and competent than devkitpro.


Ask HN (comment edition):

I know we have plenty of people here doing AoC with their own personal challenges/restrictions on top. What are yours? Solving in an eso-lang? Self-imposed resource constraints (runtime/memory)? Only using Excel? Let's hear 'em.


I can never get myself to care enough to do more than a small handful (2 to 3 per year max, if I have time in between other hobbies/family/travel and most especially work). However, my favorite restriction is to try to do incredibly terse approaches for those first few. For example, do it all in a single Python line as a large list/dict comprehension. Or do it all in a bash pipeline. Or find some way to express it all in a single line of Golang generics a-la samber/lo. Something silly that takes one of those first-few-days sub-30-minute problems and turns it into a sub-60-minute problem, but now with some amusing self-expression via extremely odd code.


> my favorite restriction is to try to do incredibly terse approaches for those first few. For example, do it all in a single Python line

Ha, this is pretty much my favorite restriction too. I try to do one single-line expression for input parsing, one for the part 1 solution, and one for the part 2 solution (eg [1]). Thought sometimes I can't manage it and I just fall back to solving it normally.

[1] https://github.com/benhaney/Advent-of-Code/blob/master/2024/...


I'm trying to complete each challenge in a different language. I've written up the first five days on my blog[1]. Have completed a few more than just these, but I don't know that I'll get all of them done by Christmas.

[1]: https://davidyat.es/2024/12/16/aoc-2024-part1/


I'm trying to fully vectorize the first few days with RVV.

The first day started of quite challanging with number parsing, sorting and set intersection. I may have gotten sidetracked trying to beat the standard library sort for a week.

It's already half way into week three and I'm still at day 2 part 2.


I find it hard enough without restrictions (especially toward the end) so I'm not doing anything too wild, but I've been trying to solve quickly this time. My goal was to get in the top 100 on one of the days to actually get a point, but I think I missed my window where the problems got too hard for LLMs but were still doable quickly for me. At least I managed a 136 which is much better than I've ever done before.

Maybe next year I'll actually prepare some utility code for parsing grids and 2d vector math and such.


Trying to juggle two kids, a mortgage, xmas and only having 30' at night to myself to even hear my own thoughts. I'd take your artificial constraints any day.


Luckily, similar to how they made a choice for these constraints, you also chose yours. Both are artificial constraints; nobody is forced to solve problems in an esolang, and very few people are forced into having kids. You could have chosen their constraints instead. You chose a constraint set difficult for you; they chose a constraint set difficult for them, and the wonderful thing is that you both can work on the problems at your own pace, under the constraints you've chosen for yourselves.


no front, but do you even read what you write? incredibly insensitive


Same. Bathroom breaks are where I get the majority of my problem solving done for AoC.


This is my first advent of code, my initial goal was solving the challenges using APL (note: I've never used that kind of language). It didn't work. :D

I continued in C++, but kind of lost interest. Next year I'll learn the language beforehand. hehe


I struggled with APL last year. This year I’ve been enjoying trying to solve the problems in uiua (“wee-wha”). It’s a symbol-based array language like APL, with a wonderful online editor and code formatter (also command line), that formats on each run, and lets you type in English keywords that it converts into symbols, so you don’t have to hunt and peck through the virtual keyboard or remember a bunch of arbitrary chords.

There’s a decent VSCode plugin but I mostly use the online pad because it’s such a rich environment. Very active Discord, with an AoC channel for help and sharing solutions - the maintainer actively iterates on the language to help them solve AoC problems.

https://www.uiua.org/

(I also fall back to Clojure when I’m struggling to come up with a uiua solution or banging my head against the stack, I kinda wish I had uiua-in-Clojure like how April is APL-in-CL)


Thank you for the hint, I didn't know Uiua. I'll definitely take a look on it.


I tried the same thing with Haskell one year with a similar result (fell back to python then gave up). The beginning was nice when the puzzles were easy and I could focus on learning the language, but once the puzzles got tough it was too much trying to struggle with them and the language at the same time.


I am doing it this year with haskell. My C++ alter-ego (ab)used Data.STRef in the previous years so I am trying to do it idiomatically this time.


why not in Typescript?


Advent of code is a boring waste of time


Whether it's boring and whether it's a waste of time are both pretty subjective. I found it to be an engaging way to shake off some rust, though admittedly I'm not going to make it through the whole month.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: