When you think of the heroes of World War II, the name Alan Turing probably doesn't spring to mind. But the British mathematician and cryptologist was instrumental in breaking the Germans' diabolically complex Enigma code, giving the Allies the upper hand and shortening the war by an estimated two years and saving 14 million lives.

Turing's accomplishment, which Winston Churchill called "the single most important achievement of the second world war," has remained relatively obscure — until now. His work and ultimately tragic life are the subject of "The Imitation Game," starring Benedict Cumberbatch and opening in New York and Los Angeles on Nov. 28 and nationally on Dec. 25. But how accurate is the movie?

"Accuracy was tremendously important to us, it was all about getting the best information we could from the best sources we could," says director Morten Tyldum. But as screenwriter Graham Moore adds, "We wanted to pay tribute to Turing's legacy and amazing life and to do that in two hours, we did standard things that people do in historical films, like compression of timelines, The way we show Alan Turing breaking Enigma is exactly how he broke Enigma, but in real life it happened in fits and starts rather than in one scene. I think we were extremely accurate on the big concepts," he adds. "We tried to stay historically faithful especially in the Bletchley years."

Bletchley refers to Bletchley Park, the Buckinghamshire headquarters of the Government Code and Cypher School, where much of the story takes place. It was so top secret that many records were burned in a bonfire when the war ended, as the film depicts, and those that survived were sealed for 50 years. "No one could talk about it for decades," notes Moore, who admits to taking dramatic license in a couple of instances. "The character named Hugh Alexander, played by Matthew Goode, is real but we gave him some traits of Gordon Welchman and Tommy Flowers," who are not in the film. Detective Nock, the officer who arrests and questions Turing and is played by Rory Kinnear, is an invention.

But other aspects, ranging from the period clothing — including some pieces with wartime rationing labels intact — to the crossword puzzle test Turing uses as a recruiting tool and the filming locations, are historically accurate.

Part of the eight-week shoot took place at the real Bletchley Park last year, in addition to other U.K, locations including Sherborne School, Turing's childhood alma mater seen in flashbacks in the film. The filmmakers had access to letters Turing wrote to the mother of his friend and classmate, which provided insight, as did the biography "Alan Turing: The Enigma" by Andrew Hodges.

Producers Nora Grossman and Ido Ostrowsky optioned the book after reading it and becoming intrigued by an article about Turing they read online in 2009. With writer Moore on board, they delved into research. "It was important to us to uncover as much information as possible. It's an important story we felt people should hear and we wanted to get it right," Moore notes.

When the script landed at the top of The Blacklist, a list of Hollywood executives' favorite unproduced screenplays, in 2011, interest escalated. With financing and a director secured, the filmmakers assembled a cast of British actors, all of them Tyldum's "first pick for every part" including Cumberbatch as Turing, Keira Knightley, Allen Leech, Matthew Beard and Goode — playing members of the Hut 8 team at Bletchley — Charles Dance as its chief and Mark Strong as the head of MI6 (British intelligence).

"Sherlock" star Cumberbatch had the challenge of portraying a complex, driven outsider who exhibits behavior that might be seen as "on the spectrum" of autism today, but Moore declines "to diagnose him after the fact. That wasn't a term that existed. None of us wanted to put a label on it, or give him a diagnosis."

Biographer Hodges concedes that Turing "was odd in lots of ways … but his characteristics don't fit the general description of autism spectrum. Pursuit of specific and narrow areas of interest is one of the most striking features of AS … and the inability to generalize and abstract away from situations. Alan Turing was the exact opposite."

Benedict Cumberbatch and Morten Tyldum discuss a scene while shooting The Imitation Game

Benedict Cumberbatch (left) and director Morten Tyldum discuss a scene while shooting "The Imitation Game."

Turing was a gay man who had no choice but to be closeted, but ultimately he was exposed, convicted of "gross indecency," and forced to undergo chemical castration that led him to commit suicide in 1954. "He killed himself by poisoning, lacing an apple with cyanide," says Tyldum, who filmed but opted not to include a scene showing that evidence, ending instead with Turing bidding farewell to the beloved code-breaking machine that cracked Enigma.

"The Enigma machine you see in the movie is the actual Enigma machine used in the war by the Nazis," says Tyldum of the mechanical code generator, which used a system of rotors to randomly encrypt messages. With millions of combinations and the code changing daily, it was unbreakable. Turing devised a mechanical "Bombe" — a code-breaker he nicknamed Christopher after the friend who first introduced him to cryptography — which is now regarded as the forerunner of the modern computer.

According to production designer Maria Djurkovic, "The real thing is within a Bakelite box, so we decided very early on that, to make it more interesting, our 'Christopher' would look as it did before it was encased in the black box, so you actually see its guts and its entrails. We had to make the Bombe look as though it works, with all its dials going round. It had to look like the real thing,"

Andrew Hodges emphasizes that Christopher "was a special purpose device, nothing like a computer, for running through possible Enigma settings and eliminating those which were incompatible with a guessed piece of message. It needed about 25 letters guessed correctly to work. It depended upon a very ingenious electrical circuit, which effectively eliminated huge numbers of possible settings at once."

A still from a scene in The Imitation Game

From left, Keira Knightley, Matthew Beard, Benedict Cumberbatch, Matthew Goode and Allen Leach in a scene from "The Imitation Game."

While a modern laptop could break the Enigma code in a second with the proper program, he says, "That's not really the point. The clever part is spotting the very ingenious idea which Turing and Welchman used. A modern programmer might very well miss this as it is not at all obvious, and is nothing like what you learn in coding. If you just set a computer to run through all the 150 million, million, million possible settings one by one, it would never work!"

Although it's not a significant part of the plot, the film does refer to prior efforts Polish code breakers made in decrypting Enigma. "There are two references to the Polish contribution in the film, smuggling the Enigma out of Poland, which they did, and Turing explains that his machine as based on a Polish design, but much more advanced," says Moore. "It was based on the Polish machine but the mechanism was a lot more complicated."

Once Enigma was broken, the Hut 8 team couldn't let on or the Germans would change the system. "We could make a whole movie about what they did to keep it secret that they cracked Enigma," says Tyldum. For instance, "they invented fake double agents to feed information to the Germans and sent spy planes over convoys to explain a bombing. The Germans never found out. Turing met the head technician for Enigma after the war and he said, 'You never broke it.' Turing didn't say anything."

Related on MNN: