When AI Thinks It Will Lose, It Sometimes Cheats, Study Finds