Link to Snippet

Flappy bird with the flappy monad

This is a crazy solution to the flappy bird dojo by Phil Trelford. It defines a custom computation builder to eliminate all mutation of the flappy bird. The script uses WPF and is playable on Windows in F# interactive, just copy the raw version, and for cross-platform implementations download: http://trelford.com/prognet15.zip

A flappy bird computation is either a function that does one step of the computation or it is completed. There is also a trick with 'Update' - here, the computation produced a flappy bird state 'Bird' that can be updated by the external world (the world changes the bird when you press a key)