Somewhere deep within Andy Herd’s computer exists the funniest Friends episode in the world. He just hasn’t seen it yet.
He has, however, been rewarded with random snippets like this:
“Chandler: (in a muffin) (Runs to the girls to cry) Can I get some presents.”
That’s part of a script that was automatically generated on Herd’s computer this weekend. He fed every Friends script into a thing called a recurrent neural network—which can learn sequences and begin to process them.
“It works by predicting the next letter to follow a given sequence of letters, and the predictions are determined by what it learned about language from the Friends dialogue provided,” he told The Daily Beast.
In other words, he fed Friends into something that can eventually make more Friends.
“It can generate stuff within minutes, but it’s barely English,” said Herd. “A lot of it is still nonsense.”
Then, after about 12 hours, magic happened.
Behold, the best scene in the history of Friends, courtesy of Herd’s new robot:
[Scene: Central Perk, marcel drops. Monica is blowing Chandler who is having lunch as Ross enters.]
Herd, who’s a software developer and online cartoonist of the popular web comic Pandyland, decided he’d post examples of his Ross & Rachel Fanfiction Machine late Monday night on Twitter. His post now has over 3,000 retweets.
So what put him up to this?
“I’ve been reading up about machine learning in my spare time lately because it’s really fascinating. I honestly don’t understand a lot of the underlying mathematics, but I’m trying!” he said. “Also, Satan helped a bit.”
Most of the cast of Friends is reuniting on NBC next month, after all. He’s got to be pretty excited about that, right?
“I guess I kind of like Friends,” he said. “It was on TV constantly for about 20 years. We had no choice.”
Herd’s using Google’s machine learning library TensorFlow, the tech giant’s artificial intelligence engine. Google made the TensorFlow open source in November. The company had been using it to help with services like Google Photo, so users could type objects and the service would bring up those objects in their own pictures.
But Herd says he’d like to use TensorFlow to make it so Chandler isn’t in a muffin so often, the entire cast doesn’t stand in a bed together, clowns aren’t so frequently lopped upon tables, and Monica stops screaming “Chicken Bob!” to no one in particular. When the Friends bot eventually gets to that point, he says he’ll “maybe make it public one day.”
Then, maybe, something weird and incredible.
“Maybe Frasier or Seinfeld,” said Herd. “Or maybe mash them all together and create The Perfect Sitcom.”
Until “The One Where Chandler Is in a Muffin” airs, Herd recommends you learn some Python and try to beat him to the best Friends episode that never was.
“I got a lot of laughs from it myself, so I just thought I’d share some of the good stuff,” he said. “Maybe it’ll get people interested in new things. And I’m not very smart, so if I can do it, anyone can.”