Hey, I've posted the game source to the if-archive, where you can study a TON of other games' source code along with this one, at
https://ifarchive.org/indexes/if-archive/games/source/
It's a fantastic resource if you want to write your own game from scratch!