איך עובד המאצ׳ינג
בכל שבוע, במוצאי שבת, אולי מציגה לך אדם אחד — לפי כלל פשוט ושקוף. בלי קופסה שחורה.
- 1מגדרים משלימים
- 2אותה עיר
- 3עד 8 שנות הפרש
- 4אף פעם לא אותו זוג פעמיים
// A couple must be opposite genders, in the same city, and within
// 8 years of age — and never a pair we've already introduced.
func compatible(a, b Person) bool {
return a.Gender != b.Gender &&
a.City == b.City &&
abs(a.Age-b.Age) <= 8
}
// Every week, after Shabbat, for each person who reconfirmed we pick
// the closest-in-age partner they have never met before.
for _, a := range confirmedThisWeek {
var best *Person
for _, b := range confirmedThisWeek {
if taken[b] || alreadyMatched(a, b) {
continue
}
if compatible(a, b) && closerInAge(a, b, best) {
best = b
}
}
if best != nil {
introduce(a, best) // one match, revealed at motzei Shabbat
}
}