To produce and direct “Shear Madness” in Portland, Good Theater artistic director Brian Allen had to pass a test. He checked himself into a hotel in Boston and crammed by watching the play in that city several times in a week. He talked to the cast and directors, and learned how the show works artistically and technically, behind the scenes and from the perspective of ticket-holders.

“Shear Madness,” an audience-participation whodunnit comedy, has run 36 years in Boston, and its originators are highly protective of their franchise. They don’t allow just anyone to produce the show.

“They checked us out. They read reviews of our plays, scoured our website,” Allen said. “They wanted to get to know us.”

He passed the test. The play opens Wednesday at the St. Lawrence Arts Center on Munjoy Hill. It will run for eight weeks, which is unusual for a play in Portland. Nearly all plays in Portland run three or four weeks, but “Shear Madness” is not like many other plays.

It is one of those mysteries where the audience solves a murder that happens offstage, based on clues that come out in the script.

 Wood, playing the role of hairdresser Tony in "Shear Madness" lets out a shout during a rehearsal of the play at the St. Lawrence Arts Center. Gabe Souza/Staff Photographer

Michael Wood, playing the role of hairdresser Tony in “Shear Madness” lets out a shout during a rehearsal of the play at the St. Lawrence Arts Center. Gabe Souza/Staff Photographer

But the script is fluid and changes from one performance to the next depending on which clues the audience observes and shares with the police investigating the crime. The cast has to learn its lines and be prepared to adapt the story depending on the observations and questions from the audience. There are only three possible outcomes, but the direction of the play turns on the participation of the audience.

“It always works, because people love problem-solving,” said Timothy C. Goodwin, an actor from New York who is appearing in the Good Theater play and his eighth production of “Shear Madness.” “Everybody likes to play an armchair detective.”

Murder mysteries that depend on the audience to help solve the crime are common, especially among the dinner-theater crowd. “Shear Madness” perfects the genre, and takes it deeper than most. It’s like a real-time game of Clue, with a laugh track.

“Shear Madness” began at a dinner theater in Lake George, New York, in 1978. Co-creators Bruce Jordan and Marilyn Abrams shared a love of the comedy of Noel Coward, and decided to adapt the German play “Scherenschnitt,” which relied on the audience to piece clues together, for American audiences. They wrote “Shear Madness” with the idea that it would run just one season.

It moved to the Charles Playhouse in Boston in 1980, where it continues today. Since then, it has been produced across the country and overseas and has been seen by 12 million people. It has run nearly 30 years in Washington, D.C., and opened last year Off-Broadway in New York.

Jordan and Abrams recently began licensing the rights to theater companies in smaller cities. Portland is the closest city to Boston where they’ve licensed the show.

“If it can run for 36 years in Boston, I ought to be able to run it for eight weeks in Portland,” Allen said.

His test didn’t end with his summer boot camp in Boston. Last week, the producers signed off on the program, the stage set and even the props. And if the Portland cast comes up with a really good joke, it becomes the property of the “Shear Madness” originators, if they want to use it in productions elsewhere. They’re also highly protective of the script itself. They authorized only the minimum number of copies that Allen needed for himself and the actors, and he could not share copies to actors auditioning for the show.

“You are sworn to secrecy,” Allen said. “They want to keep everything really tight. They have something really good, and it works because of the surprises.”

Mrs. Shubert, played by Laura Houck, at left, has her hair done by Barbara the hairdresser, played by Kathleen Kimball, during a rehearsal of "Shear Madness." Gabe Souza/Staff Photographer

Mrs. Shubert, played by Laura Houck has her hair done by Barbara the hairdresser, played by Kathleen Kimball, during a rehearsal of “Shear Madness.” Gabe Souza/Staff Photographer

The script is 150 pages, and there also are dozens of pages of questions that previous audiences have asked. The cast has to prepare for all those questions, and then be ready to take the show in the direction dictated by those questions.

The script is like a tree: It can branch in many directions, depending on the engagement level of the audience. “It really is different every single time,” said Goodwin.

Good Theater is adapting the script to Portland. The landmarks, props and jokes are local — Gov. Paul LePage is a favorite target — and the play is set in a Commercial Street hair salon. WJBQ-FM radio personality Lori Voornas makes a cameo appearance with a recorded newscast.

The victim is an elderly woman named Isabell Czerny, who lives in an upstairs apartment. She is a concert pianist, and filled Merrill Auditorium during her prime.

Early in the first act, the music stops. That’s when the audience gets involved. What did you see? What did you hear?

The house lights come up, and the questioning of the audience begins.

It’s a six-person cast. Goodwin plays Nick O’Brien, who stops in for a shave. Others in the cast are Good Theater regulars: Paul Drinan, Laura Houck, Kathleen Kimball, Conor Riordan Martin and Michael Wood.

Goodwin is key to the show. His character drives the plot, and because of his experience with “Shear Madness,” he understands the nuances of the show and how it can change night to night. He has helped other actors prepare for unknowns and contingencies, and they likely will take cues from him once the action starts happening on stage and in the seats.

Acting in “Shear Madness” has been described as like riding a unicycle: It’s easy to fall if you’re not careful, and the pace is frenetic. It’s not about improvisation, Goodwin said, but about preparation. The actors have to be aware of the audience from the very beginning, to gauge its attentiveness and degree of engagement. There are no plants in the audience to ensure certain questions are asked, and ushers and others working in the theater who may know what’s ahead are forbidden from participating.

Goodwin appeared in his first production in Rochester, New York, in 2005, and has acted in the show in Boston, Seattle and other cities across America. He came to Good Theater on the recommendation of the Boston director, based on his rapport with past audiences. It sometimes takes cajoling from the cast to loosen up the audience, and that’s something Goodwin does well, Allen said.

Timothy C. Goodwin, seated, who plays Nick in “Shear Madness,” reacts as Tony the hairdresser, played by Michael Wood, brings a hot towel to place on his face as the actors rehearse the play at the St. Lawrence Arts Center in Portland. Below: Wood lets out a shout. Below left: Mrs. Shubert, played by Laura Houck, has her hair done by Barbara the hairdresser, played by Kathleen Kimball.

Timothy C. Goodwin, seated, who plays Nick in “Shear Madness,” reacts as Tony the hairdresser, played by Michael Wood, brings a hot towel to place on his face as the actors rehearse the play at the St. Lawrence Arts Center in Portland. Photos by Gabe Souza/Staff Photographer

Allen is confident in the track record of “Shear Madness” and confident that Portland audiences will embrace being part of the show. “It’s not mandatory participation,” Allen said. “We won’t force anyone to get involved if they don’t want to. You can sit back, relax and laugh at the jokes if you want,” he said.

But if you’re the kind of person who likes to think out loud and offer an opinion, be prepared to raise your hand.