avatar

smoothie

interface
carrot + dragonfruit

Smoothie was a tool that helped me decide what smoothie to get.

why

The Hick–Hyman law states that decision time increases logarithmically with more choices. The shop lets patrons choose 1–3 fruits to add to their smoothies. There are up to 10 fruits on any given day — a total of 175 combinations. Assuming it takes ~s to consider each combination, I (theoretically) save ~22 s.

T=b·log 2 (n+1)3·log 2(175+1)=22.38

Update: I’ve decided I’d save even more time by not buying smoothies and just drinking water.

ui.background(0, 0, 0)
const re = (a) => a[(Math.random() * a.length) | 0]
 
const fruits = [
  "dragonfruit",
  "watermelon",
  "apple",
  "mango",
  "banana",
  "carrot",
  "strawberry",
  "lychee",
  "pineapple",
]

function mix() {
  const a = re(fruits)
  const b = re(fruits)
  return a === b ? a : a + " + " + b
}

const text = ui.addButton(mix(), 0.15, 0.45, 0.7, 0.1).onClick(() =>
  text.setText(mix())
)
smoothie source code