A game that lets players to play with software development is a great way to teach programming and coding concepts such as loops and conditional statements. Zachtronics Shenzhen I/O is a game that accomplishes this. It puts players in the shoes of angry engineers who work for a boring company and are required to design computer chips manually. The circuits they’re required to design get more difficult beginning with making the lights flash in a particular pattern.
The interface of the game is very similar to that found in browsers, and it teaches this link scripting. Screeps is a great example, which blends JavaScript code with massively multiplayer online gaming in order to create self-sustaining colonies. Both games do a wonderful job of teaching the basics while slowly introduction of new ones.