One team used programming prowess to reach the final matches of the FIRST Robotics Competition. They used the Microsoft Kinect gaming system to navigate the field.

The Ace of Spades by Team 987, the High Rollers from Las Vegas, is a mean-looking machine that made a run deep into the national FIRST Robotics Competition in St. Louis this past weekend. But the key to this basketball-playing bot is its brain, which is the domain of a father-son duo of programming wizards.

Brandon Hjelstrom, a programmer on the team, has been coding for six years. At age 9, he created his first programming software, which was used to convert measurements. Brandon loves video games and says he started coding because of his dad, Greg, who's a High Rollers mentor. Greg currently works at Petroglyph games and has contributed to such titles as Star Wars: Empire at War and End of Nations, among other titles for Xbox and PC.

Together, Brandon and Greg are the architects of Ace of Spades' brain. The robot features an Xbox Kinect sensor at its top that controls the shooting mechanism's rpm and its targeting system by sensing the reflective tape above each basket and calculating how much force is needed to make a shot. Large chunks of code broken into modules handle that as well as the robots' primary functions such as the turret, drive, and aiming system. Brandon and Greg tweak the code before every match, trying to perfect it. In fact, Brandon says, they changed one-third of the robot's entire code in the days before their important matches of the competition. "I love how coding is iterative and keeps changing," Brandon says.

The High Rollers' machinist, Trevor Ritz, says the team spent most of the season trying to perfect the Kinect aim system. The machine averages 90 percent of its shots and can shoot comfortably from anywhere within 12 feet of the basket. "It's incredibly accurate," he says.

Advertisement - Continue Reading Below

That includes when the team lets the robot roam autonomously. During the first 15 seconds of every match, no one can manually control the robots. This rule encourages teams to incorporate precoded commands to their machines. The High Rollers have four presets they can select. One of those has the robot shoot two balls, run backward, knock balls off the bridge, reload, and shoot again. This all happens before anyone takes the controls.

Greg Hjelstrom has been a FIRST mentor since 2005, and has worked as a technical director for more than two decades. Greg says he and his son have bonded over their love of coding. Brandon, a first-year member of the team, has already coded two of his own video games: Piggy Bounce for Windows Phone and Phat Fly for Xbox Live. Both are arcade games. "His game beat out mine," Greg says, "and was one of the top games much longer than mine."

The High Rollers' streak came to an end just short of winning it all. But father and son will keep coding on the weekends, with Greg drawing the art as Brandon mans the computer to input the code. "A lot of people don't know that even the simplest games take a long time," Greg says.

A Part of Hearst Digital Media
Popular Mechanics participates in various affiliate marketing programs, which means we may get paid commissions on editorially chosen products purchased through our links to retailer sites.