Friday, December 20, 2024

Getting deep recursion to work in a simple Ruby program

As part of one of my Advent of Code 2024 solutions, I wrote a small program that included a fairly deep level of recursion. 

When run on my Mac, using Ruby 2.7.2, the program failed to run to completion, generating a stack trace like this (shown in part for brevity):

Traceback (most recent call last):
    3304: from day-16/day-16-part-1-dfs.rb:125:in `<main>'
    3303: from day-16/day-16-part-1-dfs.rb:86:in `explore_map'
    3302: from day-16/day-16-part-1-dfs.rb:86:in `each'
    3301: from day-16/day-16-part-1-dfs.rb:96:in `block in explore_map'
    3300: from day-16/day-16-part-1-dfs.rb:86:in `explore_map'
     ... 3292 levels...
day-16/day-16-part-1-dfs.rb:87:in `key?': stack level too deep (SystemStackError)

I could have fixed this by rewriting my recursive function to use a queue instead, but I wanted to see if I could change my runtime configuration to get my program to run as-is; and I was able to do so! I ended up needing to change TWO things to get the program to run successfully.

First, I needed to increase the system stack size limit for my Mac, for the current terminal session. For my particular program, I needed to set it near my machine's max:

ulimit -s 65520

(The default stack size limit had been 8176.)

Making just that change allowed my program (when run from that terminal session -- not from my IDE) to reach a deeper count of recursions; but it still failed with a similar error:

Traceback (most recent call last):
    10920: from day-16/day-16-part-1-dfs.rb:125:in `<main>'
    10919: from day-16/day-16-part-1-dfs.rb:86:in `explore_map'
    10918: from day-16/day-16-part-1-dfs.rb:86:in `each'
    10917: from day-16/day-16-part-1-dfs.rb:96:in `block in explore_map'
    10916: from day-16/day-16-part-1-dfs.rb:86:in `explore_map'
     ... 10908 levels...

day-16/day-16-part-1-dfs.rb:32:in `hash': stack level too deep (SystemStackError)

Second, I needed to set an environment variable to increase the Ruby VM's maximum allowed stack size. For this "toy" program, I just picked an arbitrary very large value:

export RUBY_THREAD_VM_STACK_SIZE=50000000

With that change also in place, my program was able to successfully run to completion!

I did end up refactoring my solution from using a depth-first search to a breadth-first search, which, in addition to not needing to deal with Ruby's limit on recursion stack depth, was a lot more efficient for solving that particular problem.

I wanted to make a note on what I did, though, so that if I ever face a situation again where I'm bumping up against a Ruby stack depth limit (and a solution other than increasing the limit isn't called for), then I'll be able to remember what I did this last time!

Sunday, October 06, 2024

ClipEmoji.com Updated With New Unicode v16.0 Emoji

Despite the fact that emoji pickers are built into major desktop operating systems these days -- as well as into some specific apps like WhatsApp and Slack -- I still find myself using my own site ClipEmoji.com for quickly getting a copy of particular emoji characters to paste into prose I'm writing.

As such, I took some time this afternoon to make a small update to ClipEmoji.com to add the few recently-added new emoji characters in the Unicode v16.0 Emoji set, such as "🫩" ("face with bags under eyes").

Additionally -- and probably more notably! -- I noticed that the Unicode Consortium added in this version a bunch of new "synonyms" (descriptor words) for existing emoji. For example, the words associated with the simple "👍" were previously:

  • thumbs up +1 hand

Now, in v16.0, the set of synonyms for 👍 is:

  • thumbs up +1 good hand like yes

Since the search on ClipEmoji.com is powered by these synonym words (plus a few custom additions of my own), you can now search for "like" and 👍 will be included in the filtered search results, for example.

Enjoy!

Friday, July 26, 2024

Computer eye strain sufferers: Try "Eyezen" glasses

First off: I'm not an eye doctor; I'm just a guy who spends a lot of time in front of a computer! Double-check anything I'm telling you here with your optometrist or ophthalmologist before you do anything else with this information.

Secondly: This isn't a paid post; I'm not receiving any kind of compensation from it. I'm just a fan!

The last several years, I had been suffering from moderately severe eye strain while working in front of my computer all day. Even though I have a nice setup where my monitors are set up a a little over two feet away from me, after  working for a solid hour two, my eyes would kind of "cramp up," feeling fatigued. I'd need to either close them for a couple of minutes, or at least spend time intentionally looking at a wall or object a longer distance away (e.g. across the room), in order to let my eyes recover enough to resume looking at my monitors and continue working.

At my most recent optometrist visit several months ago, my optometrist -- shout out to Dr. Staci E.! -- prescribed "Eyezen" glasses. The glasses that I got are designed specifically for "near-distance" vision: Things that I look at far away through them are somewhat blurry; but the glasses produce really excellent clarity when looking at my two-feet-away computer monitors!

glasses

These glasses have made a very positive difference in my day-to-day job. When I sit down at my computer, I swap out my "everyday wear" glasses for the Eyezen glasses, which I just keep at my desk. Wearing the Eyezen glasses while working, my eye strain symptoms have mostly disappeared! I no longer get eye "cramps" or fatigue that forces me to stop working to "un-strain" my eyes on a frequent basis. 

When I get up from my desk, I swap my Eyezen "computer glasses" (as I think of them) back out for my daily wear glasses. This is obviously an extra step, but I haven't found it to be at all onerous. The cost has definitely been worth the benefit.

As I hadn't previously even been aware of the existence of specialized "near-distance vision" glasses, or Eyezen glasses, I figured I'd share my experience to spread the knowledge! My new glasses have really helped me; if you suffer from eye strain while working on a computer all day, consider asking your eye doctor if they might be a good option for you, too.

Monday, June 03, 2024

Vigil RPG 3.0 is now available!

Vigil RPG, my classic-style turn-based role-playing game for iPhone, has been updated to a new major version, 3.0! 

Vigil RPG logo

For the first time in 10 years on the App Store: Vigil RPG is now free to download! Vigil RPG has always been a "premium" title, where paying once got you the full game, with no ads, premium currencies, stamina timers, or other such impediments. Vigil RPG still has none of that, but now you can download Vigil RPG from the App Store and play the first portion of the game for free! After that, the game offers a single, one-time in-app purchase, which permanently unlocks the full game for you across all of your devices.

(And of course -- as is only right!-- I added code such that everyone who bought Vigil RPG prior to this v3.0.0 update will continue to have access to the full game (including the other major updates in the new version) without needing to buy the IAP.)

The other major feature in the Vigil RPG 3.0 update is Honor Mode! Inspired by a certain awesome hit 2023 AAA RPG -- (okay, fine, I'll just come right out and say that it's obviously Baldur's Gate 3) -- players considering themselves Vigil RPG veterans (or just hungry for maximum challenge right out of the gate?) can now optionally take on this challenging new difficulty. It features enhanced boss enemies with new move sets, and like Hardcore mode in the Diablo series before it, PERMADEATH upon defeat!

You can see all of this for yourself via a free download of Vigil RPG on the App Store.

Need an expert opinion first? Read a review of Vigil RPG at TouchArcade.com.

Learn more about Vigil RPG on the Vigil RPG website.

Saturday, December 16, 2023

The Jon Schneider Game of the Year awards: 2023

 

Starting with my favorite video game that I played for the first time this year, and continuing on with the rest of the top 10, these were my personal top games of 2023 (along with the platform(s) on which I played them)!

1. Baldur’s Gate 3 (Windows / Mac)

There are so many facets to this game that, on their own, are exceedingly well done, and joined together, make for an incredible game. The adaptation of D&D 5E combat and mechanics. The overall story. The individual party members, and their stories. The smart way in which the game’s world and characters realistically respond to your actions. It speaks to BG3’s quality that it is the first long-form game in a very long time that I played through from start to finish -- and then immediately made a new character and started a second play-through.

2. Zelda: Tears of the Kingdom (Switch)

It ALSO speaks to Baldur’s Gate 3's quality that when I played Tears of the Kingdom earlier in 2023, I felt that it was the best game I’d played in several years, and a lock for game of the year! A more-than-worthy sequel to Breath of the Wild (my personal 2017 Game of the Year). Hyrule is once again super fun to explore -- this time with the additions of caves, the sky, the underground, and more things to do. The construction system managed to successfully achieve making me feel like “I’m not just a fantasy warrior, I'm a fantasy warrior engineer!”

3. Super Mario Bros. Wonder (Switch)

In my opinion, the best new 2D Super Mario game in 32 years(!!) (Super Mario World, SNES, 1991). The combination of more traditional-style Mario 2D gameplay with the “wonder” sequences in the various levels made for a great combined experience. The pseudo-multiplayer real-time “ghosts” of other players that you can see -- and to a limited extent, interact with, but very importantly, not in any toxic way -- was also a neat (optional) addition which I ended up being quite glad that I had decided to leave enabled.

4. Cobalt Core (Steam Deck / Windows)

This recently-released, spaceship-battle-themed roguelike deckbuilder came out of nowhere for me to claim this high spot on my crowded GOTY list this year. It adds to the traditional Slay-the-Spire-like ability to block incoming damage an ability to move laterally to dodge incoming fire (or to take it on more-armored parts of your ship). Battles are quick and punchy. Even though Cobalt Core is mostly not mechanically similar to FTL, it did give me some of the smartly-designed vibes of that game.

5. Infernax (Steam Deck)

A solid, 8-bit-style platforming action game in the tradition of Castlevania 2 (NES). The tight gameplay and fun progression were enough to keep me engaged straight through from start to credits.

6. Dave the Diver (Steam Deck)

A scuba-speargun-fishing main game mashed together with restaurant management sections, complete with a perfect-beer-pouring minigame? Why does this work so well? Once again, it's because all of the individual pieces are so solid! The charming character design and pixel art certainly don’t hurt, either. The first game in this year’s list that I haven’t actually finished yet: I played mostly in Early Access, decided to set it aside until the full 1.0 release -- and haven’t picked it back up quite yet due to the strength of all of the other new games on offer this year.

7. Octopath Traveler 2 (Switch)

This year’s turn-based JRPG comfort food. An interesting battle system, combined with a story that was decent enough to keep me playing straight through to the end -- albeit for only some of the characters, not all 8. As with the first series entry, my wish would be for better interaction between the 8 protagonist characters.

8. Outer Wilds (Steam Deck)

After having this game on my to-play for a few years, I finally had a good way to play it when I acquired a Steam Deck in the early part of 2023. As I had heard about Outer Wilds prior to playing, this is a game worth playing without being spoiled on what it is all about! I will say to give it a try if a first-person, solo exploration game where you board and fly your own spaceship (while still in the first-person perspective) and explore a small solar system sounds appealing. I did admittedly eventually get stuck on how to progress further (and didn’t want to consult a guide) -- but not until after quite a few hours of really interesting exploration and discovery.

9. Tunic (Steam Deck)

For me, Tunic created a vibe of being a kid back in the pre-Internet days, and having a new Nintendo cartridge to play -- but there's no real in-game help, and the instruction booklet that came with the cartridge (which in Tunic's case is discoverable in pieces within the game itself) is mostly in Japanese (a language I can't read) -- but the booklet's bits of English text, plus illustrations, allow for puzzling out the less obvious parts of game's mechanics and objectives. Add that to some overhead-view Zelda-like combat -- except tricky, with some Souls-like aspects -- and Tunic ends up being pretty cool and unique experience.

10. Alina of the Arena (Mac / Windows)

A last-minute list addition! Another roguelike deckbuilder hybrid -- this time with Into-The-Breach-like tactical positioning, with a solo character you control facing off with one or more enemies on a small hex grid.

Honorable Mentions

A few of the other games I played which were good, but didn’t make this year’s Top 10, in approximate descending order of where they would have appeared on the list, had there been room: Retro Bowl College (iPhone), Diablo 4 (Windows), Pinball FX (Windows), 30XX (Steam Deck), Tinykin (Steam Deck).