dialog typing

also separated the game logic into its own js file