added ability to write out games into a file