Rewrite game loop to use pure functions.
Update TODO.