as this episode was transpiring , a loop of confusion was running inside the artificial mind of iapetus v. its programming re-wrote itself again and again as it attempted to come to terms with an irresolvable ethical dilemma .