All files / web/src/arcade-games/know-your-world/utils hotColdPhrases.ts

0% Statements 0/46
0% Branches 0/1
0% Functions 0/1
0% Lines 0/46

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47                                                                                             
/**
 * Hot/Cold feedback phrases for Know Your World
 *
 * Provides audible feedback as the user moves their cursor
 * toward or away from the target region.
 */

export type FeedbackType =
  | 'found_it' // Actually hovering over target!
  | 'on_fire' // Very close but not over target
  | 'hot' // Getting closer, close distance
  | 'warmer' // Getting closer, medium/far distance
  | 'colder' // Getting farther, medium distance
  | 'cold' // Getting farther, far distance
  | 'freezing' // Getting farther, very far
  | 'overshot' // Was close, now moving away rapidly
  | 'stuck' // Not making progress, searching aimlessly

const PHRASES: Record<FeedbackType, string[]> = {
  // Actually hovering over the target - encourage clicking
  found_it: ["That's it!", 'Right there!', 'Click it!', 'You found it!', 'Bingo!'],

  // Very close but not over target yet
  on_fire: ["You're on fire!", 'So hot!', 'Burning up!', 'Almost!', 'So close!'],

  // Getting closer
  hot: ['Getting hot!', 'Super warm!', 'Getting close!', 'Toasty!'],
  warmer: ['Warmer!', 'Getting warmer!', 'Good direction!', 'Heating up!'],

  // Getting farther
  colder: ['Colder!', 'Getting colder!', 'Wrong way!', 'Not that way!'],
  cold: ['Cold!', 'Pretty cold!', 'Getting icy!', 'Way cold!'],
  freezing: ['Freezing!', 'Ice cold!', 'Way off!', 'Brrrrr!'],

  // Special cases
  overshot: ['You passed it!', 'Go back!', 'Too far!', 'Turn around!'],
  stuck: ['Try a different direction!', 'Explore somewhere new!', 'Keep searching!'],
}

/**
 * Get a random phrase for the given feedback type.
 */
export function getRandomPhrase(type: FeedbackType): string {
  const phrases = PHRASES[type]
  return phrases[Math.floor(Math.random() * phrases.length)]
}