Minecraft, from the Swedish game developer Mojang, looks like a 3-D fairy tale that was cranked through the Matrix and came out rendered in blocks. Players can use modifications or “mods” written in Java and can build mods of their own design. You can play in “survival” mode — battling “creepers” and zombies — or “creative” mode, in which you build anything from a house to a village to a fantasy world. The latter seems to be especially appealing to girls.

Code.org, despite millions in funding and a push from President Obama, is not yet mainstream. Minecraft, however, is. Lady Gaga released a Minecraft-themed music video in March and “The Simpsons” riffed on the game in the credits of an episode in April. Minecraft has 100 million registered users; spend any time around elementary- and middle-school kids and you’ll see that it has cornered the market.

“We’re happy about the Minecraft phenomenon because it is just about creating,” said Dr. Rusk of M.I.T. “First it seemed like it was mostly boys, but now a lot of girls are getting engaged in Minecraft.”

Image Credit... Pippin Barr

A hundred students were on ThoughtSTEM’s waiting list for its first Minecraft class two months ago. “I would say that the girls are actually outperforming the boys, at least in my class,” Mr. Foster said. “And it’s very good to see, because as computer scientists, we definitely recognize that there’s a big gender disparity in our field.” He added, “There are just so many girls who play Minecraft who, as far as I’m concerned, are all people who can be swayed to pursue coding — they just don’t realize it yet.”

Kimberly Bryant, who spent a decade as an engineer in biotechnology, is the founder of the educational nonprofit Black Girls Code. Gaming has evolved into one of what Ms. Bryant calls the “core pillars” of Black Girls Code. “We find that it taps into every element of coding necessary to be a technologist,” she said. “You have the design, basic computational skills, math.” She favors gaming platforms and languages that are designed to teach coding, like Scratch, Alice and a new platform called Beta.

To avoid perpetuating the tech industry’s glaring gender gap, schools should look more closely at these grass-roots initiatives that have had success in attracting and inspiring girls. One X factor seems to be the presence of female role models, which can be hard to come by when you’re one of the only girls in your computer science class. Girls know the stereotype of a geeky guy hacker in his basement all too well, and interacting with women who use computer science in their professional lives gives them an idea of something to go after besides an endless string of code. Many of the instructors, coding evangelists and students I spoke with credited a female mentor who nudged them along.