Games of Coding – A curated list of games that teach you a programming language
I'm not sure if such games can help to learn programming. For example, Robocode is very dynamics-based and requires knowledge of control theory (which involves partial differential equations) and decision making under uncertainty. I'm doing software development for almost 10 years and yet such games are too hard for me. These games can help you to learn "AI" but not programming. It's simpler to create your own Robocode game from scratch than to master creating bots for it.