Emma Boettcher, a 27-year-old Chicago librarian, called on her knowledge of Shakespeare to defeat James Holzhauer. (Jeopardy Productions)

Emma Boettcher has spent a lot of time thinking about what makes a “Jeopardy!” clue difficult.

The 70-page final paper she wrote in 2016 as the capstone for her master’s degree in information science at the University of North Carolina dealt with that very subject. Using thousands of clues scraped from the show’s archive, she painstakingly analyzed whether a computer could correctly guess a trivia question’s difficulty level based on factors like its length or wording. (The answer was that certain characteristics, such as the number of noun phrases, were indeed giveaways.)

“The question I started out with was, How do people perceive what’s difficult, and how can we train a computer to make those same types of predictions?” Boettcher, 27, told Vulture. “The ‘Jeopardy!’ board values its clues going from top to bottom. I was parsing the text of those clues for length, the words used in each, the syntax, and whether they linked out to audiovisual materials."

She added, “I was very lucky to find an adviser who completely went with it.”

But when Boettcher finally got the chance to compete on the show herself, the final clue didn’t stump her at all.

Heading into Final Jeopardy on Monday’s episode, the University of Chicago librarian was narrowly leading James Holzhauer by $3,200. Up until that point, Holzhauer, a 34-year-old professional sports gambler who had won 32 consecutive games, was on track to beat the earnings record set by Ken Jennings in 2004. He had already won more than $2.46 million to Jennings’s $2.52 million and shattered the show’s record for most money won in a single game, trading on his ability to make quick mental calculations as well as the realms of knowledge that he had picked up while reading children’s books.

Then, host Alex Trebek read the final clue out loud: “The line ‘a great reckoning in a little room’ in ‘As You Like It’ is usually taken to refer to this author’s premature death.”

Boettcher, who majored in English at Princeton University and wrote her undergraduate thesis on Shakespeare, couldn’t have been better prepared. She decided to go big, wagering $20,201 that the answer was Christopher “Kit” Marlowe, the Elizabethan writer. “If there’s a dream category for me, it’s Shakespeare,” she later told Vulture.

Holzhauer, too, guessed Marlowe. But he wagered only $1,399, an amount so small that Trebek couldn’t help but point out how atypical it was for him to make such a modest bet.

“So, Emma, it’s up to you: If you came up with the correct response, you’re going to be the new ‘Jeopardy!’ champion,” Trebek said. “Did you?”

She did. The audience gasped as it became clear that her big gamble had paid off, and that Holzhauer was not unstoppable after all. Boettcher, the new champion, walked away with $46,801 and a high-five from her former rival.

“It’s an amazing feeling, truly,” she told the Philadelphia Inquirer. “Just being on ‘Jeopardy!’ was one dream for me. And then to be on and hold my own was another dream. And then to be on and hold my own and then win was just way beyond anything I ever expected.”

The stunning upset was the result of years of practice. A native of the Philadelphia suburbs, Boettcher got hooked on “Jeopardy!” and competitive trivia while she was still a teenager. She auditioned for the show four times, starting when she was a senior in high school, she told the Inquirer. During her college years at Princeton, she began tracking the clues she got right and wrong as she played along at home so that she could assess her weak spots.

She also fine-tuned her strategy, studying wagering tutorials and using a pen or a toilet-paper holder as a makeshift buzzer as she simulated playing on the show from home. Her plan, she told the Chicago Sun-Times, was to hunt for Daily Doubles and start with the highest-value clues. That calculated approach paid off in the second round, when she correctly nailed both of the Daily Doubles.

But despite all her careful preparation, she was caught off guard when she learned that she would be facing off against a champion whose 32-episode winning streak and millions in earnings made him one of the greatest players of all time. Because of the show’s taping schedule, she reported to the studio on March 12 to film the episode that aired on Monday. At that point, none of the episodes featuring Holzhauer had aired.

“That was the first time I had heard of him,” Boettcher told the Chicago Tribune on Monday. “Those numbers, I heard them, and I thought, ‘That’s not real, what’s the real number?”

The numbers were correct, but Boettcher couldn’t dwell on what that might mean. As the cameras began rolling, she forced herself to stay in the zone, ignoring her pounding heart and the surreal feeling of being on the stage with Trebek.

Then, for nearly three months, she was sworn to secrecy. While she quietly watched at home, the man she defeated grew to be a sensation, and viewers wondered if he had broken the game. As Holzhauer kept edging closer to the record, it gradually dawned on Boettcher’s colleagues that she was going up against a man who seemed impossible to beat.

“I thought, if anyone could do it, Emma can,” Elisabeth Long, a supervising librarian at the University of Chicago, told NBC News. “She loves 'Jeopardy!’ and I think has been preparing for this her whole life.”

When the episode finally aired on Monday, viewers were stunned by Holzhauer’s dramatic loss. Except, that is, for other librarians, who found it utterly unsurprising that one of their own would stay cool under pressure while summoning up arcane trivia facts from a superhuman repository of knowledge.

“Not shocked that he lost to a LIBRARIAN,” tweeted the person running social media for the library system in Kitchener, Ontario.

Speaking to Vulture, Boettcher said that while she didn’t think being a librarian made her uniquely qualified for “Jeopardy!”, there was no question that she was working in an environment where knowledge was deeply valued.

“No question is too small, and no research avenue is too weird or unheard of,” she said. “You’re around a lot of people who are fascinated by everything. It’s such a great place to be in to keep that love of learning going all the time.”

Boettcher plans to use her winnings to pay off her student loans. But she’s also looking forward to making a donation to UNC’s library school, where she authored her master’s paper on the show.

“I gained so much from that experience academically, and I think this would be a nice way to bring that full-circle,” she told the Tribune.

More from Morning Mix:

A duchess winked behind Trump’s back. What was she telling us?

‘We are concerned’: Dallas police ask for FBI help after third transgender woman murdered