Converting the moves into sets removes duplicates.