This is kind of a starter project so please report any bugs in the comments.
I copied this project from Code Your Own Games By Max Wainewright