A love calculator looks like the simplest app on the internet: two names in, a percentage out. We run one at LoveCalcs in 11 languages, and doing that properly turned out to have a few interesting edges. Here are the ones that needed most care, with the real code.
1. The same names must always give the same score
If two friends type the same names and get different results, the whole thing feels broken. So there is no randomness: the score is a pure function of the two names.
The main score is what we call the Affinity Quotient. It blends five sub-scores, each from 0 to 100: letter frequency similarity (L), a simplified phonetic match (P), how close the first letters are (S), vowel balance (B) and a numerology-style "destiny number" (N):
// Apply weights and calculate final score // AQ_raw = 0.25·L + 0.20·P + 0.15·S + 0.15·B + 0.10·N + 15 const rawScore = 0.25 * L + 0.20 * P + 0.15 * S + 0.15 * B + 0.10 * N + 15 ;
// Clip to [0,100] and round to 1 decimal place const final = Math . round ( Math .…