Artificial intelligence has captured the rhythm of science fiction. For example, the script of a new science fiction short is the creation of a bot. Although the software provides the order of the word choices, the source material is human. It works by algorithm and it derives its poetic power from the words of human feeling. The results are surprisingly good and even funny, in spite of its mechanized origins.

If that first paragraph sounds a little odd, that’s because a human being didn’t write it — or at least not entirely, anyway. Instead, I fed several articles about artificial intelligence into an algorithmic text emulator, gave it some input about word choices, and voila: I had the lead paragraph for my story. It was a strange but surprisingly intuitive process.

Bots and algorithms that can generate content or augment the work of human writers aren’t new. They’ve been used to write about sports and finance for TV networks and financial analysis firms and automatically generate stories about earthquakes and homicides for the Los Angeles Times. This month, the people behind the film “Morgan” released a trailer that had been created by Watson, IBM’s artificial intelligence product. On Kickstarter, screenwriter William Goldwin successfully raised over $30,000 for “Impossible Things,” a horror film whose core narrative elements were determined by an AI that curated data from over 3,000 films.

But now writers and artists are starting to use algorithms and AIs to do something that many people think should be impossible for a machine: entertain us.

I wrote the first paragraph of this article — if indeed we can call it writing — using a tool created by a man named Jamie Brew. He’s the head writer at the satirical website Clickhole, but in his spare time he developed a predictive text program that has allowed him to generate strange and hilarious parodies by feeding it all different types of content: X-Files scripts, Craigslist ads, romance novels, IMDb content warnings, the grammar rules of Strunk and White and synopses of Batman: The Animated Series.

Brew is certainly not the only person doing these sorts of experiments, and the internet has long been entertained by the antics of countless bots, from Microsoft’s ill-fated chatbot Tay to “ebooks” bots that remix content from Twitter feed to create new tweets that sound both bizarre and familiar. But Brew’s tool produces text that feels more human and intentionally funny than the word salad of most bots.

“You ever notice how many people die from some kind of violence? A coincidence named the truth,” says Agent Fox Mulder in an X-Files script algorithmically generated by Brew. “What do you think happened to the X-Files, Scully? What happened to keep them under the bowling alley? What do you think it means?”

It’s hard to put your finger on exactly how it’s different until you learn how it works. Most algorithmic text generation you see on social media is automated. Twitter bots, for example, use Markov chains, algorithmic tools that analyze what words are most likely to follow others in the source material. The tool then automatically generates new text where words are sorted based on those linguistic probabilities. The user doesn’t have much say in the matter. Brew prefers a more hands-on approach.

“With my program, instead of making a random choice that you don’t get to see, it gives you the top 10 options [for the next word] and lets you choose at each step, in the same way that a predictive-text phone feature does,” Brew said. “It’s not entirely algorithmic.”

In practice, this means that while you have no control over the words that spring forth, your choices can shape how the garden path unfolds. Rather than fully automating the process of assembly of the text by turning it over to a program or bot, Brew’s work is more of a collaboration between a human being and an algorithm.

“It’s not letting the algorithm do all of the work,” said Brew. “It makes it more fun for me to use, I don’t just feel like a programmer making a proof of concept. I still feel like a writer.”

It’s a fine distinction, and sometimes a confusing one. After all, when a writer or programmer uses the words of dozens or hundreds of other people as the source material for new machine-generated content, who’s the creator: the person programming the AI, the authors of the original works or the AI itself?

It’s a question that came up for technologist Ross Goodwin and director Oscar Sharp while they were making the science fiction short “Sunspring,” which starred “Silicon Valley” actor Thomas Middleditch.

Sunspring’s script was written by an AI called Benjamin, which was trained using a long short-term memory (LSTM) recurrent neural network and hundreds of scripts from science fiction films and television shows like “The X-Files,” “Star Wars,” “Blade Runner” and “Brazil.”

“We’re always writing from our experiences of things that we’ve read and what we’ve heard and things that we’ve absorbed verbally,” Goodwin said. “So to what extent can anyone author anything? And to what extent does this machine augment this capacity?”

Sharp said the first version of Benjamin only generated dialogue, but he quickly realized that unlike the “clunky and clumsy” text generation he had seen in the past, Benjamin’s words did something extraordinary: they made him feel something. “And I thought hang on, if I can feel emotions like this with prose, I can give this to an actor.” Eventually, says Sharp, the AI was able to produce the five-page script for Sunspring that included more traditional screenplay descriptions of setting and action. (“He is standing in the stars and sitting on the floor,” reads one particularly evocative line of direction.) Unlike Brew’s program, Benjamin takes a more typical automated approach to generating content. Sharp and Goodwin were adamant that there be no editing of the words that Benjamin delivered, regardless of how tempting it was to tweak the language into something more sensical or intentional.

The actors added their own very human interpretations of the text that Benjamin produced. “[They] were able to breathe sense and meaning and dynamic and subtext and interaction and conflict into those words effortlessly,” said Sharp. “They didn’t have to stop and think about it, they just read it and soon everyone is laughing their heads off, it’s the most delightful thing. It’s the same sort of delight as you experience when someone points up at the sky and says, ‘Oh look at the rabbit in this cloud.’ That pareidolia effect of seeing a pattern where you know that there was no intentional pattern.”

Many viewers had a strong reaction to “Sunspring.” While the creators got some negative feedback from people angered by the mere concept of an AI film, critics described it as beautiful, bizarre and strangely moving. Sharp said that some people who watched the movie were moved to tears, which made him wonder about the relationship between them and Benjamin. “So are they making a connection, and if so to whom?” he asked. “It could be they’re connecting to the actors, it could be that they’re connecting in a gestalt way to all the writers who wrote the input corpus, they’re making this broader connection which is sort of an exciting idea — not connecting to one writer or five but somehow hundreds or thousands, even millions of writers.”

The point of these sorts of algorithmic experiments, then, is less about proving that an algorithm or AI can produce written work that passes for human, and more about how human beings interact with the words that are produced — either as viewers, performers, writers or any other form of creative interpreter.

Sometimes, Brew said, it seems as if the strange and delightful products of his program were “already latent” in the texts he gave it. What emerges feels a bit like a funhouse mirror of the source material, echoing it in language, tone, even theme. Not only can it hold a mirror up to the tropes and cliches of both pop culture and culture at large, but also the biases contained in their content.

Sharp notes, for example, that the most popular words produced for “Sunspring” — after articles such as “a” and second-person pronouns such as “you” — were specifically about men (“his,” “man,” “he”). That reflected the disproportionate focus on male characters in the source materials. “There’s also an obsession with father relationships way more than mother relationships,” he said. “You get a lot of [mentions of] police, you get a lot of prostitutes. It’s sort of chastening. One of the ways that Benjamin works is as a mirror that shows us what we’ve been doing unrelentingly.”

The idea of robots creating our entertainment might sound dystopian, but to Brew, Goodwin and Sharp, it’s not about outsourcing creativity to machines but rather using machines to help people express their creativity in new ways. Computer-generated text can already make us laugh with its Mad Libs absurdity or move us emotionally through serendipitous connections; perhaps someday it will be capable of entertaining us in even more nuanced ways. Regardless, it seems like there will always be a human hand and heart in the mix, whether it’s creating the algorithm, writing the source material or guiding the choices of the machine more directly.

The way Goodwin sees it, an AI or an algorithmic text generator isn’t an author so much as a tool, and one that could allow human creators to input source text that inspires them — perhaps even from their own work — and prompt or inspire them to “produce something that is more closely aligned with their internal thoughts and notions.”

“One of my mentors, Allison Parrish, likes to point out that a generative text machine is like a space probe,” Goodwin said. “But rather than exploring what we understand spatially, they’re exploring the boundary between sense and nonsense. I think there’s a lot of interesting transmissions that you can receive from that boundary.”

CORRECTION (Sept. 29, 6:40 p.m.): An earlier version of this story misidentified the roles that Ross Goodwin and Oscar Sharp played in the making of “Sunspring.” Goodwin was the technologist and Sharp was the director, not the other way around.