CAMBRIDGE — Central Square Theater’s current production of “Breaking the Code” presents a compelling portrayal of Alan Turing, the legendary mathematician and World War II codebreaker, but concludes with a divisive new epilogue that has sparked mixed reactions.

The play, originally written by Hugh Whitemore in 1986, centers on Turing’s groundbreaking work cracking the German Enigma code at Bletchley Park and explores his personal struggles, particularly relating to his homosexuality, which was criminalized during his lifetime. Eddie Shields leads the cast with a nuanced performance that captures both Turing’s intellectual genius and his vulnerability. Shields portrays the complexity of Turing’s character with meticulous attention to detail, from his stammer to subtle nervous habits, delivering a performance praised as one of his finest in recent years.

Surrounding Shields is a strong ensemble, featuring Boston theater veteran Paula Plum as Turing’s imperious mother, Sara, who reveals unexpected compassion in key scenes. Matthew Beagan plays multiple roles, including Ron Miller, whose affair with Turing contributes to the mathematician’s downfall. Josephine Moshiri Elwood, David Bryan Jackson, and Dom Carter provide layered portrayals of figures connected to Turing’s life and work, enriching the narrative.

The production’s design elements notably complement the story’s tone and themes. Janie E. Howland’s scenic design incorporates suspended screens that flash computer code, equations, and everyday imagery, reinforcing the tension between the technical and personal aspects of Turing’s life. Sound designer Aubrey Dube’s work enhances the atmosphere with a hypnotic and mysterious soundscape.

“Breaking the Code” touches on Turing’s tragic postwar fate: convicted in the early 1950s for “gross indecency” due to his homosexuality, he underwent hormone therapy and died by cyanide poisoning in 1954 at age 41, in a death ruled a suicide. While the play effectively conveys the harshness of Turing’s treatment and the sorrow of his untimely death, some critics have noted it misses opportunities, such as dramatizing Turing’s actual moment of decrypting the Enigma code, opting instead for descriptive monologues.

A significant point of contention in this production is the inclusion of an added epilogue by British writer-director Neil Bartlett, marking its first appearance in a U.S. staging of the play. This new ending, delivered by a character representing a student from 2026, presents a direct and overt message about Turing’s enduring technological legacy and the ongoing impact of his life’s story. The scene concludes with a symbolic embrace linking past and present.

While director Scott Edmiston introduced the epilogue to provide a less despairing conclusion than Whitemore’s original, some viewers have found its tone melodramatic and at odds with the play’s otherwise restrained narrative, arguing it disrupts the emotional balance established throughout. A spokesperson for Central Square Theater confirmed that the addition is optional and is authorized through a separate licensing agreement. Edmiston reportedly chose to include it for this production.

Overall, the staging of “Breaking the Code” at Central Square Theater offers a powerful examination of Alan Turing’s achievements and hardships, underscored by strong performances and thoughtful design, though the appended epilogue has elicited debate about its appropriateness and impact.