copyright (c)1986, 1987, 2009, 2016 William Schaeffer
When this worm gets stuck, it looks ahead only one move. If the worm finds an escape path, it chooses that direction: right path or left path. If the worm gets absolutely stuck with no escape, then the worm reverses direction.
Originally programmed in Commodore 64 Basic on the Commodore 64.
I worked on this program and the "simple logic" for two years in my spare time. And then I realized in 1988 that the Commodore 64 was an obsolete machine and it was not worth spending any more time to invest in learning it.
I was surprised a few years later, when I got a Mac Performa, that there was no longer any good Basic programming environment on the computer. In fact, there was no longer any good software development environment, for individual programming and coding, on any personal computer at all. People stopped writing computer programs. Software writing and software development had been divorced from software use. I did not realize the full social implications of this restriction at the time. I do not think that anyone today really does either, except for the people that ultimately made it happen. Curious.