For explorations of simple mechanisms like this leading to complex behaviour, Valentino Braitenberg’s book Vehicles is a classic.
The author passed away 15 years ago so I will mention the PDF of the book shows up in the first few search results on Google.