Baraka and Calaya got a one—the best possible ranking—on the Gorilla Species Survival Plan’s matchmaking scale. Photograph by Connor Mallon / Smithsonian’s National Zoo

Baraka, a four-hundred-pound silverback gorilla, couldn’t take his eyes off the twelve-year-old Calaya when she arrived at the National Zoo, in Washington, from Seattle. He already had two females in his family, but “he was very taken by Calaya from the get-go,” Becky Malinsky, the zoo’s assistant curator of primates, told me. “She was in quarantine for thirty days, but he had visual access. He wanted to look at her all day. They were smitten from the beginning.”

Within an hour of being allowed in the same room, they mated. The match was no accident. It was years in the making—the result of a complex algorithm for pairing gorillas that may be more reliable than dating Web sites for humans. It’s certainly more detailed.

The dating site for gorillas is now a key to survival of a species officially considered to be critically endangered. Over the past two decades, between sixty and seventy per cent of western lowland gorillas have been wiped out. The Ebola epidemic is estimated to have killed about a third of the population—tens of thousands—in the wild. Across central Africa’s Congo Basin, the greater danger is humans hunting gorillas for bushmeat and as trophies. Despite anti-poaching laws, thousands of gorillas are killed each year, even in protected reserves and national parks, because of limited resources for enforcement. Expanded logging and oil-palm plantations have increasingly destroyed their natural habitats.

The initial algorithm was developed in the late nineteen-eighties—seven years before its human counterpart—as part of the Gorilla Species Survival Plan launched by the Washington-based Association of Zoos and Aquariums. It’s been regularly refined ever since. Its calculations are based on age, experience, socialization skills, lineage, genetics, and, especially, personal chemistry.

“It’s a lot of science and a lot of personality,” Kristen Lukas, the chair of the gorilla-survival plan and the director of conservation and science at the Cleveland Metroparks Zoo, told me. Zoologists know when it works. “Gorillas can make guttural love vocalization that would make you blush,” she said.

Baraka and Calaya were a good match because he is laid-back and attentive to his troop, the name for a gorilla family. She is confident, quirky, and creative, Malinsky, the curator at the National Zoo, told me. As we watched the gorillas in the zoo’s Great Ape House, Calaya lay on her back atop a thin fire hose stretched high between tree limbs. She weighs over a hundred and fifty pounds, and the flattened hose was only a few inches wide. “She’s a pro at balancing,” Malinsky said. Calaya doesn’t like to step on the ground—one of her quirks—so the zoo has arranged milk cartons for her to sit or step on. She’s particularly imaginative in incorporating blankets—as many as she can gather—into her nests. (Gorillas make new ones daily.) As Calaya slept on the high-wire hose, Baraka knuckle-walked with muscular agility among the exhibit’s rooms every few minutes, to check on Calaya and the rest of his troop. He also kept an eye on two bachelor gorillas in an exhibit nearby.

The gorilla-matchmaking algorithm ranks potential mates on a scale from one to six. One is the best pairing: the mates’ genes are rarer, so their offspring would enrich gorilla diversity. Gorillas with common genes pull lower scores—and the survival plan may recommend that they never breed. Females can still join a family, but they are often put on birth-control pills to prevent them from having babies, Lukas said. A human committee—pulled from more than fifty North American zoos—has a “studbook” with pages of scientific data and personality traits on each gorilla for the matchmaking deliberations.

Baraka and Calaya got a one on the survival plan’s matchmaking scale. The other two females in Baraka’s harem, Mandara and Kibibi, are now not recommended for breeding. Mandara has already had six babies; she is now on birth control, which is crushed up and fed to her every morning in yogurt or a banana. (The St. Louis Zoo runs a reproductive-management center on contraception for all North American zoos.) Kibibi, third female, age nine, tends to outperform the National Zoo’s other five gorillas in cognitive research tests. But she won’t be allowed to breed with Baraka, either. They’re a poor genetic match.

Both in the wild and captivity, the majority of male gorillas do not have families—and do not breed. Gorillas are a polygamous species. A troop usually consists of one adult silverback—named for the thick silver hair running from their conical heads, down their broad backs, to their narrow torsos—with two to four females. They live with their offspring until the young are old enough, in their teens, to leave their natal group. Because of the social structure, however, two-thirds of male gorillas do not have mates, since more dominant males keep them away from females.

“They never get the chance—just do the numbers,” Malinsky told me. “There are not enough females.” The males end up in bachelor groups, some with bonds as deep as a heterosexual troop. So the Gorilla Species Survival Plan also uses an algorithm to pair males whom biologists hope will be good companions, too. “The first consideration is always what’s best for the individual gorilla,” Lukas said.

For years, the Cleveland zoo had two males living together in a bachelor dyad. Mokolo was a Type A prone to exhibit dominance daily; Bebac was a chilled-out Type B who deferred to his roommate, Malinsky said. When Bebac died last year, of heart disease, the zoo looked for new companions for Mokolo through the studbook. It identified Fredrika—mature, confident, and hard to rattle—who lived at Zoo Miami, and Kebi Moya, a female who had long lived among large troops, at the zoo in Columbus, Ohio. In September, both arrived in Cleveland to join Mokolo.

“We weren’t looking to breed. Fredrika was too old and Kebi had health problems,” Lukas told me. Mokolo also has heart disease. “We just wanted to give them all companionship.”

But Mokolo hadn’t been anywhere near a female for more than two decades. The two females bonded immediately. “They were cool. They did beautifully,” Lukas recalled. But she was worried about what Mokolo would do. Males are almost twice as large as females; they have large canines that can seriously injure.

“I’ll never forget what he looked like,” Lukas said. “Mokolo could smell them. Suddenly, he puffed up. It was nervousness mixed with prowess—‘I hope to impress these ladies.’ He tried to appear as big as possible, but his eyes were darting back and forth—like, ‘Oh, my God. Oh, my God. What do I do now?’ You could feel the tangible experience that Fredrika brought to the table. She knew how to respond. If he got too close, she would bark. For Kebi, it was her first time being with a new male. Over time, they became more and more cohesive.” Mokolo mated with the females, but not for breeding.

“It was all about giving them companionship,” Lukas explained. “The guy had been so used to his buddy.”

Do gorillas make love connections? “So many of us could tell you stories of very special connections,” Lukas recalled. In one recent encounter, she said, Fredrika and Mokolo had sex face-to-face, which is rare among nonhuman species. “At one point, she leaned up and put her lips to his chest, then she came down and they completed,” she said. “Was that a kiss? Probably not. You’re a scientist and supposed to be observing. But there certainly was some tenderness.”

The instant attraction between Calaya and Baraka has stuck. After she arrived in Washington, in 2015, she was kept on birth control until last year, when she fully acclimated to all members of the troop. After she was taken off the pill, she soon became pregnant. Calaya and Baraka are expecting their first baby next month.