9 ms·
[Follow up read] Why developers never use state machine: http://www.skorks.com/2011/09/why-developers-never-use-state-machines/ http://www.skorks.com/2011/09/wh
by punnerud 10y ago
[Follow up read] Why developers never use state machine:
http://www.skorks.com/2011/09/why-developers-never-use-state-machines/ http://www.skorks.com/2011/09/why-developers-never-use-state...
- magoghm 10y agoI almost always use state machines.
- jops 10y agoState machines in games should be a lure enough for the kids: http://gameprogrammingpatterns.com/state.html http://gameprogrammingpatterns.com/state.html
- myhf 10y agoScratch is actually pretty good at expressing state machines. Since all statements are atomic and all scripts on a sprite run in parallel, you can write one script that says forever: wait until Today == Saturday repeat until Today != Saturday: do things outside and another script that says forever: wait until Today == Thursday repeat until Today != Thursday: if there is trash: take out the trash and then any process that updates `Today` will cause the sprite to perform the right behavior on the right day.