stupid end-of-game function implemented, will need HEAVY refactoring