Core logic of the game. Provided by Lab professor.