Skip to main content
Elliott Grieco

Recurse: W1D3

Recurse center: W1D3

Some things I did and worked on at the Hub:

  1. Commuted downtown by bike (UWS -> Downtown Brooklyn)
  2. Went a couple lessons into The last algorithms course you'll need, practiced some binary search
  3. Realized I needed some extra practice on groking binary search, decided to try some animating
  4. Went with p5.js, since it's a good starting point for the skills I have
    • Realized that the p5.js editor is cool, but lacks type-checking that I am used to at this point
    • the types package exists, and next steps was to get it working in a nice hot-reloading environment
    • Success! Here's my project setting up the animation in p5
      • Maybe turn it into a template repository? 🤔
  5. Ended the day with listening to some 'non-programming presentations' at the Recurse center, where I heard people present about biking across New Zealand, eating lightbulbs, role-play STEM education, and how to fairly cut a cake -- or any kind of divisible resource -- fairly.

Working on the P5.js animation

Animation and graphical work is pretty new to me.

Here's what I got done for the animation so far:

W1D3 progress on a binary search illustration

(commit)

As I was going through:

I realized that it was superior to structure my code in a (very light)'state-machine' pattern

Before

Using a series of boolean flags to manage state through progress in an animation

After

Using string literals as markers of discrete states to gate progress through animation phases

And while I could do some work to tightly couple these state enums to the data pieces that are relevant just to that 'scene', for now I just used comments to organize it: (see lines)

Example of organizing state using some basic comments

Finally, the usefulness of this state technique definitely came to life when I could easy 'jump scenes' in order to debug and tweak certain parts of my animation. This combined very well with the TypeScript + hot-reloading setup:

TypeScript + hot-reloading setup so that I can quickly iterate on visual tweaks to the animation

And that's definitely something I always value -- put in a little bit of effort for the most useful kind of fast-feedback possible:

Some hopes for tomorrow: