In an effort to make engineering and math more fun for middle school kids and engage more young girls to pursue the STEM fields, Vertex Pharmaceuticals has partnered with Boston Public Schools and i2 Learning in a two-week coding camp this summer.

At Bridge Boston Charter School, more than 100 Roxbury and Dorchester middle school students have been eagerly coding Root robots, making the machines dance to Michael Jackson’s “Thriller” and compete in capture the flag — activities that teachers and officials say disguise math and science learning as fun and games.

The students at the Vertex Discovery Camp are from public, private and charter schools — the Dearborn STEM Academy, Dudley Street Neighborhood Charter School, Mother Caroline Academy, Epiphany School and Bridge Boston.

“They are learning math. They are learning science. But they don’t think they are. They think they are playing capture the flag,” said Ethan Berman, founder of i2 Learning, which created the STEM — or science, technology, engineering and math — curriculum being used.

The camp is part of Vertex’s 10-year $50 million commitment to STEAM education, which also includes art, in Boston and other communities. It is targeting middle schoolers, young girls in particular, because they often tend to lose interest by the time they reach high school.

“We are sitting in a sea of talent here in Boston — talent that is too often wasted or overlooked,” said Vertex CEO Dr. Jeffrey Leiden. “The Vertex Discovery Camp is about getting kids engaged in science at an early age and showing them how much fun it can be. Hands-on experiences like this take learning out of textbooks and into real-world settings to help get students excited about and equipped for careers in STEM.”

“It’s critical,” agreed Makeeba McCreary, executive director of the BPS Office of External Affairs. “If there is not an emphasis at the elementary and middle school level to get them ready for high school and careers, we’ve missed the mark.”

The camp has placed a special emphasis on engaging female students — enrolling more than 50 percent girls to encourage them to pursue careers in engineering, math and science.

“This has been a deliberate attempt to involve girls in STEM,” said Melissa Aybar, a teacher at Epiphany School who is teaching a CSI class at the camp. “With socialization and what we’re shown about what we can do and what we should do, it doesn’t include science. They don’t internalize it. Here, we say you are scientists, engineers. It has to be deliberate.”

Nylani Andrade, 9, of Mother Caroline Academy, said she had no interest in science before coming to the camp this week. She loved learning residue analysis using salt as part of a crime scene investigation.

“I didn’t before. Now I do,” she said. “I saw how interesting it is.”