Spider's Square

From Esolang
Jump to navigation Jump to search

A program written in Spider's Square describes an abstract spider, represented by a moving point, building a web inside a one by one square. The spider can move along the sides of the square, and may place the start of a thread at any point along them. Once the start of a thread has been placed, the spider may move about normally, but may not start another thread until the current one is ended. The spider may end a thread by attaching the other end to the place it is climbing. If the spider is at the attachment point of a started or completed thread, it may divert its path and move along the thread, and may also attach further webbing across the existing thread.

The spider may also choose to let go and fall, either catching onto a thread or landing on the bottom of the square. When diverting or falling, the spider may have a requirement as to the angle of the thread relative to the spiders direction, and will ignore threads that do not meet it. In the case of multiple matches, a falling spider will grab the first available, If multiple threads are reached at the same time, and in the case facing multiple paths to divert to while climbing, the spider will choose randomly.

If the spider has started a thread when it falls, the thread will be set at the distance between the start of the thread and the point the spider drops from as it falls. The spiders path will then move along an arc around the thread's starting point if the thread is pulled taunt, affecting what threads it will grab. This arc ends if the spider does not grab a thread or land before reaching the point of the arc directly below the start of the thread, it either lowers to the bottom side of the square or retracts to where it started the thread, and will still be able to grab onto thread as if it was falling during this time.

The program should allow for input in the form of locations where flies may appear, but the only output should be the final state of the web, thus making it essentially input-only. The precision with which the spider, thread, and flies are placed are up to the implementation, though the relative precision of the different objects should be predictable, and the relative size of the spider to the flies should be specified at the start of the program along with the flies' position and number.