Complete solution for game-of-rotation