DEV Community

Song Jack
Song Jack

Posted on

The Math Behind Cross-Referencing 4 Divination Systems

I built an AI fortune telling website that cross-references 4 divination systems. Here is the actual logic behind the cross-referencing algorithm.

The 4 Systems

  1. Western Astrology - Sun sign based on birth date
  2. Chinese BaZi (Four Pillars) - Heavenly Stems + Earthly Branches from birth date/time
  3. Tarot - Random card draw with question context
  4. Numerology - Life Path Number from birth date digits

Why Cross-Reference?

Each system has blind spots:

  • Astrology: Too generalized (only 12 signs)
  • BaZi: Needs exact birth time
  • Tarot: Random, different every time
  • Numerology: Only uses birth date, ignores time

When multiple systems agree on a trait, the confidence increases.

The Algorithm

function crossReference(astrology, bazi, tarot, numerology) {
  const themes = {};

  // Extract themes from each system
  const astroThemes = extractThemes(astrology);  // e.g., ["leadership", "fire", "action"]
  const baziThemes = extractThemes(bazi);         // e.g., ["strong fire", "direct"]
  const tarotThemes = extractThemes(tarot);       // e.g., ["initiative", "courage"]
  const numThemes = extractThemes(numerology);    // e.g., ["independence", "pioneer"]

  // Count occurrences across systems
  [...astroThemes, ...baziThemes, ...tarotThemes, ...numThemes]
    .forEach(theme => {
      themes[theme] = (themes[theme] || 0) + 1;
    });

  // Themes appearing in 3+ systems = high confidence
  // Themes appearing in 2 systems = medium confidence
  // Themes in 1 system = supplementary insight
  return Object.entries(themes)
    .sort((a, b) => b[1] - a[1])
    .map(([theme, count]) => ({
      theme,
      confidence: count >= 3 ? 'high' : count >= 2 ? 'medium' : 'low',
      sources: getSources(theme)
    }));
}
Enter fullscreen mode Exit fullscreen mode

Example Output

For someone born March 15, 1990:

Theme Astrology BaZi Tarot Numerology Confidence
Leadership Pisces (debatable) Strong Fire The Emperor (4) Life Path 1 HIGH
Creativity Pisces ✓ Wood element The Magician (1) Life Path 1 HIGH
Emotional depth Water sign ✓ Water in chart The Moon (18) Not present MEDIUM

The cross-referencing makes the reading more personalized than any single system alone.

Try it yourself →

Top comments (0)