Implements basic game logic