smoothie

interface
carrot + dragonfruit

Smoothie was a tool that helped me decide what smoothie to get at a local shop that lets customers choose between 1–3 fruits and vegetables to combine.

According to the Hick–Hyman law, decision time increases logarithmically with more choices. There are up to 10 options on any given day—a total of 175 combinations. Assuming it takes ~s to consider each combination, I (theoretically) save ~22 s?

T = b * log2(n + 1)
22.38 = 3 * log2(175 + 1)

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

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

const text = ui.addButton(mix(), 0.15, 0.45, 0.7, 0.1).onClick(() =>
  text.setText(mix())
)
main.js