Before the code · Learning science

The Super Mario Effect

Mario doesn't tell you you're a bad person when you fall in a pit. He puts you back at the start of the level. Here's the same puzzle under two different framings — pick one, play it, and notice how you feel about guessing.

Framing

A three-digit lock. Enter a guess and each dial tells you whether it's too high or too low. Nothing else. Go.

?
?
?
0 attempts

Lesson 02 · Strings, loops, functions

A Caesar cipher

Shift every letter forward. Easy — until z needs to become c. Drag the shift and watch the red cells: that's the wraparound, and that's what% 26 is for.

Encrypteddwwdfn dw gdzq

(0 + 3) % 26 = 3 → 'a' becomes 'd'

Lesson 04 · Objects

An object as a counter

An array stores values by position. An object stores them by key — which makes it a tally sheet. Paste anything in and watch the keys appear.

0words
0unique
longest
    The eight lines doing the work
    function countWords(text) {
      const counts = {};
      const words = text.toLowerCase().replace(/[^a-z\s]/g, "").split(/\s+/);
    
      for (const word of words) {
        if (word) counts[word] = (counts[word] || 0) + 1;
      }
      return counts;
    }

    More is coming

    The full lesson sequence — variables and input, the cipher, arrays and data summaries, objects and word counting — each has a working version, practice set, homework, and tests behind it. They land here as I convert them.

    Next up: a systems-design sandbox where you place components and I break them on purpose.