reducing game loop logic to outside methods that can be tested