Gads, you folks miss the most obvious explanation... alien abduction.
Yes that's the most obvious one. However not quite so obvious is the
conjecture of some that Chin was in fact himself an alien all along,
incognito, programming Yarn only for something to do while waiting
for the mothership to arrive.
To say any more than this would be pure speculation.