First working version. Does not determine when a game is over on its own.