March 4, 2026 at 05:47 PM EST
Spotting elements quickly in arrays, matrices, and boards
March 4, 2026 at 05:47 PM EST
Spotting elements quickly in arrays, matrices, and boards
To prevent myself from committing off-by-one errors, I built components to quickly spot elements across arrays, matrices, and boards. This time, I poked around Svelte.
Given an index i in zero-based numbering, you can find its corresponding entry by starting the count from 0, but I prefer to pinpoint that entry by counting the i elements before it. For example, the index of F is 5, because there are 5 elements before it. If you’re into music, you can shift the array left and right with the arrows to change the root key.
Choose the displayed matrix entry, and tread carefully — it’s zero-indexed. Once selected, a word with a link to its definition will appear.1.
Press the “Roll” button below or press “r” on your beautiful keyboard to roll dice. Then, press the tile you’ll land on based on that result. Consecutive rolls move you to the right position of the previous roll.
When I waste mental bandwidth on meddlesome calculations, I seek to automate them. How about yourself? Which small operations sap your energy?
No comments on this post yet. Be the first to share your wisdom :).