Inspiration can strike at the oddest times. For producer and psychologist Riaz Patel, that time was during the blackout in New York City in 2003. “It was this bizarre situation where you were with people you didn’t know trying to accomplish certain things and figure out solutions to everyday problems,” he tells mental_floss. “That’s where I thought, ‘There’s something about working with people you don’t know, in situations you’ve never been in, that could be a really interesting basis of some sort of a show.’” A couple of years of rumination later, and the idea developed into his latest series, Race to Escape. The game show, which premieres tomorrow on the Science Channel and is hosted by Jimmy Pardo, pits two teams of strangers against each other—and a clock—in an attempt to escape a room by working together to find clues and solve puzzles. Each week, there are two new teams, locked in two new rooms, with five bolts separating them from a grand prize of $25,000. The game, Patel says, had to be challenging, but winnable—“because if it hadn’t been winnable, then the audience would feel it and they would just turn the channel.”

The designs of the rooms run the gauntlet from a study to an auto mechanic’s shop. Picking the environments happened during a “very long brainstorming day,” Patel says, and each one had to fit very specific criteria. They couldn’t be places that were “so foreign that someone wouldn’t know where to start,” Patel says. “Putting them in sort of a weird crypt that’s set in Mesopotamia would be very, very hard, because they’d go on like, ‘We don’t even know where we are.’” So they stuck with places that would be familiar to people, among them a barber shop, a neighborhood bar, a study, and a Chinese restaurant. The rooms also had to be tactile and big enough to fit multiple people and give them space to move around. (One idea that didn’t make the cut for this very reason? An elevator.)

Next up: creating the challenges. Like the environments, the challenges had to meet certain guidelines. First, Patel and the show’s team wanted them to be in line with the theme of the room. “They’re all very, very organically connected to the environment,” he says. “A challenge that you find in the neighborhood bar would be different than a challenge you would find in the auto garage.” The challenges needed to be big enough so the audience could see what was happening, and doable in the amount of time allotted. They also needed to be equal parts brainy and physical. “We’d call them MacGyver challenges,” Patel says. “They’d have to physically do things as opposed to just sitting and figuring things out just in their head. That’s not good TV.”

The hardest part of designing the challenges, Patel says, was “keeping the contestants on a course so they couldn’t jump from clue one to clue four.” A tough thing when some clues were hidden in plain sight: “We would be so nervous: What if they happened to look under this rug? Then they’d see something that they’re not supposed to see yet. So it really has to be very well designed—they’re only given as much information as they need to solve that challenge.”

When the challenges were done, the art department created another layer that producers called the “red herring path”: Things that made sense for the environment but weren’t necessarily connected to the puzzles. “That’s something that we really went back and forth on,” Patel says. “How to streamline those rooms so that they feel like real environments, but still don’t have too much that it would be distracting and hard to move forward—that was a balance we had to find.” 

Once the teams are locked inside, there’s no communication between the producers and the contestants, so each room, and the puzzles it contained, didn’t just have to be carefully designed—they also had to be thoroughly tested. Individual challenges were tested eight to 10 times, then assigned to certain rooms, at which point, the room “was tested five times from start to finish just to make sure that we didn’t have any issues,” Patel says. “We’d have a target, and then we would see if the testers would veer off course and make adjustments,” which included details as small as the size and type of font used for the clues. They never had to throw out a challenge, Patel says, just adjust the amount of information given: “We had to troubleshoot a million things before we could actually lock that door.” 

All told, Patel says, “hundreds and hundreds of hours went into every room.” Each room was built in four days, tested, and then filmed in for 60 minutes. That night, the crew would strip the room and start over. “I’ve never done a show where I had to throw everything out after an episode and start from scratch,” Patel says. “That was a challenge.” 

The show isn’t just a game: There’s a heavy dose of science, too. As the contestants are trying to solve the puzzles, Pardo is offering scientific explanations for their behavior. “I didn’t want people to look at it and just assume that human behavior is random,” Patel says. “There are certain stresses and factors that are going into their behavior—in certain rooms, the heat would even go up. In retrospect, we could certainly look at the influences on the contestants and explain to the audience this is what’s happening—this is what they’re feeling physiologically, this is what’s preventing them from seeing the solution to a problem.”

For Patel, whose first job was at a mental institution and who graduated with a triple major from the University of Pennsylvania (where he also won a medal from The National Psychology Honor Society), the most fascinating part of the game show was, perhaps, the behavior of the contestants once they were locked in the rooms. “You cannot predict human behavior. You cannot,” he says. “I think there’s a real difference between who you project you are and who you really are. You have no history with these people, and no history with this room. What comes out of you organically is a bit different than your normal day-to-day. People who say ‘I'm a diehard leader,’ they get into the room, and suddenly they are terrified and they are a follower. Or someone who says ‘I'm amazing at puzzles,’ and in that moment they cannot figure out the simplest things. I feel like this game really shows you authentically because you have no time to prep. All you can do is react—and I love that.”

Race to Escape premieres July 25 at 10/9c on the Science Channel.