Code to solve the 2048 puzzle