An immense number hours are poured into Microsoft’s world-building game Minecraft every day. By 2014, players, many of them children, will have spent 199,722 years playing Minecraft on just the Xbox 360 alone. That’s a lot of wasted time. But what if those hours could be used for more than just idle entertainment?
That’s what Microsoft (MSFT)wants to find out. The company has developed a new tutorial aimed at children as young as six that uses Minecraft characters, and concepts, to teach kids how to code. The program was developed with help from Code.org, a non-profit focused on getting young people interested in science and technology.
The tutorial was created for Code.org’s Hour of Code, a nationwide campaign in its third year that has drawn support from several Silicon Valley giants. Last year, President Barack Obama participated in an Hour of Code in Newark, New Jersey, while Apple (AAPL) held hour-long coding tutorials at its retail stores across the county. One of the company’s programming workshops last year even featured characters from Disney’s Frozen.
The Minecraft-based tutorial introduces basic coding skills in a 2-D world that mimics the same environment players would find in the popular software game. Minecraft is well suited for educational purposes, because it’s a game based solely on building things. In the tutorial, individual blocks become actions, which can be combined to generate computer code. The free tutorial includes 14 different lessons.
Code.org has long focused on getting more girls and minorities interested in computer science, and one advantage to using Minecraft is that it appeals to both boys and girls—more so than other popular games like Halo or Star Wars. “Minecraft is a special game that girls and boys alike often can’t be pried away from,” Code.org CEO Hadi Partovi said in a statement.
There’s also an economic reason for Microsoft to support Hour of Code. The company will hold this year’s tutorial sessions at its stores and offices, and also hand out Windows Store gift cards to teachers who organize their own coding events. If the tech company can lure more teachers back into its Windows ecosystem, it might be able to stem the rise of Google (GOOGl) Chromebooks in the classroom. Additionally, if kids get used to using Microsoft products it may influence their future purchasing decisions.
This isn’t the first time that Minecraft has been used for educational purposes. A nine-year-old built a Minecraft-based modification last year to teach kids how to create their own mods using Java. Earlier this year, an online course by Youth Digital taught children how to custom-code Minecraft environments and characters. Meanwhile, the Australian government uses Minecraft as part of its contests to design national parks.
In fact, there’s also a special version of Minecraft specially designed for schools that is sold under the company’s educational license. If you’d like to try out the tutorial, you can give it a spin here.
Sign up for Data Sheet, Fortune’s daily newsletter about the business of technology.
For more on Microsoft, check out the following Fortune video: