Rough game logic. Completely untested! (may need to npm install fs)