updated ai to take into misplaced digits