All files / web/src/arcade-games/rithmomachia/constants captureRelations.ts

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

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 48 49 50 51 52 53 54 55 56 57                                                                                                                 
import type { RelationKind } from '../types'

/**
 * Color scheme for each capture relation type
 */
export const RELATION_COLORS: Record<RelationKind, string> = {
  SUM: '#ef4444', // red
  DIFF: '#f97316', // orange
  PRODUCT: '#8b5cf6', // purple
  RATIO: '#3b82f6', // blue
  EQUAL: '#10b981', // green
  MULTIPLE: '#eab308', // yellow
  DIVISOR: '#06b6d4', // cyan
}

/**
 * Mathematical operator symbols for each relation
 */
export const RELATION_OPERATORS: Record<RelationKind, string> = {
  SUM: '+',
  DIFF: '−',
  PRODUCT: '×',
  RATIO: '÷',
  EQUAL: '=',
  MULTIPLE: '×',
  DIVISOR: '÷',
}

/**
 * Human-readable descriptions for relation tooltips
 */
export const RELATION_TOOLTIPS: Record<RelationKind, string> = {
  EQUAL: 'Equality: a = b',
  MULTIPLE: 'Multiple: b is a multiple of a',
  DIVISOR: 'Divisor: a divides evenly into b',
  SUM: 'Arithmetic Sum: a + c = b',
  DIFF: 'Arithmetic Difference: b − a = c',
  PRODUCT: 'Geometric Product: a × c = b',
  RATIO: 'Geometric Ratio: b ÷ a = c',
}

/**
 * Get relation color with fallback
 */
export function getRelationColor(relation: RelationKind | null): string {
  if (!relation) return '#6b7280' // gray fallback
  return RELATION_COLORS[relation] || '#6b7280'
}

/**
 * Get relation operator symbol with fallback
 */
export function getRelationOperator(relation: RelationKind | null): string {
  if (!relation) return '?'
  return RELATION_OPERATORS[relation] || '?'
}