move game logic out of swing's event loop