That's crazy how does the spider know how to do this. One of those things like how it knows how to weave a web that looks relatively symmetrical.
edit: regarding making some form of AI seems you need understanding like "if electric field, deploy web, fly" sort of thing. inference?