4 ms·
My favorite use case for generators (I was using C# at the time, but it applies equally well to any language with yield) was for implementing a turn-based game
by munificent 4y ago
My favorite use case for generators (I was using C# at the time, but it applies equally well to any language with yield) was for implementing a turn-based game loop:
http://journal.stuffwithstuff.com/2008/11/17/using-an-iterator-as-a-game-loop/ http://journal.stuffwithstuff.com/2008/11/17/using-an-iterat...
- mrozbarry 4y agoI have done something similar, https://github.com/mrozbarry/mob-turnbased-rpg/blob/master/src/game.js https://github.com/mrozbarry/mob-turnbased-rpg/blob/master/s...