Recurse: W1D3
Recurse center: W1D3
Some things I did and worked on at the Hub:
- Commuted downtown by bike (UWS -> Downtown Brooklyn)
- Went a couple lessons into The last algorithms course you'll need, practiced some binary search
- Realized I needed some extra practice on groking binary search, decided to try some animating
- 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? 🤔
- 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
After
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)
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:
- Fast code feedback via TypeScript; fail at compilation, not runtime!
- Fast visual feedback via hot-reloading
Some hopes for tomorrow:
- Improve (finish?) the animation to show how binary search works -- something like this page, but with my own twist
- Consider if its worth to publish a basic vite + p5.js setup, since I came up with my own 'flavor' of getting the beginning working (this blogpost for webpack got me started, with some adjustments)
- ← Previous
Recurse: W1D2 - Next →
Recurse: W1D4-5