---
layout: ../Site.layout.js
---
# Planned Simulation spiral scenario (plant/insect/bird) in theory
While we got [some very fun randomness working last time](/lispgames/LCKR-running-the-simulation/), this time I want a specific interesting scenario to happen at least once.
In particular, I want a `locust` that eats `tree`s to chase a `tree` propagating away from the `locust` swarm: However, the `tree` also tries to avoid other `tree`s. Chased by `locust`s and encountering other `tree`s in front of it, the `tree` turns northways (`n`) instead of running directly away from the `locust`s east.
The `tree` is faster than the `locust`s, so turning north, the `locust` confusedly continues propagating `e` (encountering the `tree`s our `tree` swerved north to avoid, but this is somewhat unimportant).
However, while now unchased by `locust`s, our `tree` encounters other `tree`s, which it turns southwards to avoid.
This takes it back into the field of view of at least one surviving `locust`, causing the `locust`s to turn northwards upon seeing a `tree` that way.
This will illustrate that two scenarios are possible in the simulation: firstly that a fast-moving `tree` can escape `locust`s by changing direction (which it will do if it sees another `tree` or `locust` in front of it as well as behind),
and secondly that a `tree` that escaped `locust`s by turning, faced with crowding by other `tree`s, will sometimes turn back towards a `locust` infected area.
When the later `tree` propagates into a `locust`'s field of view to the north, the `locust` will turn northwards, and discover a new population of `tree`s.
The goal right now is to observe once a simulation where a `tree` escapes `locust`s, faced with overcrowding, turns back towards the `locust`s, inadvertently alerting the `locust`s to a new `tree` population.
If this is successful, I will hope to find simulation conditions with long-lived wavefronts of `tree`s repeatedly escaping and being re-caught by `locust`s: Such a stable wavefront could be inhabited by higher order predators such as `bird`s as well as different `plant`, `insect`, and `bird` variations which are unsustainable by themselves, but can survive in and contribute to a broad mosaic ecosystem.
## Theory
### A `tree` that flees and a `locust` that chases
(ASCII) Pictographically, in the defined simulation. this scenario will already propagate (actually automatically, since the default direction choice is `e`ast):
```
⬜⬜🌳
🪳⬜⬜
```
Taking `tree`s to have a `propagation-distance` of `2`, and `locust`s a `propagation-distance` of `1`, and both having a `sensor-scale` of `1` here. `locust`s have a `eating-range` of `1` and a `lethality-rate` of `100` (i.e., their `prey-species` always dies).
One time step:
```
⬜⬜🌳⬜⬜🌳
🪳🪳⬜⬜⬜⬜
```
Two time steps:
```
⬜⬜⬜⬜⬜🌳⬜⬜🌳
🪳🪳🪳⬜⬜⬜⬜⬜⬜
```
The `tree`s already escaped, but the `locust`s will catch up to any particular `tree`, eventually.
## `tree` also avoiding overcrowding
Still in timestep 2:
```
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲
⬜⬜⬜⬜⬜🌳⬜⬜🌳⬜⬜
🪳🪳🪳⬜⬜⬜⬜⬜⬜⬜⬜
```
According to our simulation logic, the middle `tree` now sees
1. if it goes east, it will be next to a `tree`
1. if it goes northeast, it will be next to a `tree`
1. if it goes north, it will not be next to a `tree`
Since this is the order of considered next moves,
timestep 3:
```
⬜⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲
⬜⬜⬜⬜⬜🌳⬜⬜🌳⬜⬜
🪳🪳🪳🪳⬜⬜⬜⬜⬜⬜⬜
```
we get here.
### The `tree` encounters more overcrowding
Still in timestep 3:
```
⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲
⬜⬜⬜⬜⬜🌳⬜⬜🌳⬜⬜
🪳🪳🪳🪳⬜⬜⬜⬜⬜⬜⬜
```
Timestep 4:
```
⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲⬜
⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜
🪳🪳🪳🪳🪳⬜⬜⬜⬜⬜⬜
```
(Since diagonals happen 'slower' than orthogonals)
### `tree` eventually moves back towars `locust`s
Timestep 5:
```
⬜⬜⬜⬜⬜⬜🌲⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜⬜🌲⬜⬜⬜
⬜⬜🌲⬜⬜🌳⬜⬜🌲⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲⬜
⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜
🪳🪳🪳🪳🪳🪳⬜⬜⬜⬜⬜
```
Timestep 6:
```
⬜⬜⬜🌲⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜🌲⬜⬜⬜⬜
⬜⬜⬜⬜🌳⬜⬜🌲⬜⬜⬜
⬜⬜🌲⬜⬜🌳⬜⬜🌲⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲⬜
⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜
🪳🪳🪳🪳🪳🪳🪳⬜⬜⬜⬜
```
Timestep 7:
```
⬜⬜⬜🌲⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜🌲⬜⬜⬜⬜
⬜⬜⬜⬜🌳⬜⬜🌲⬜⬜⬜
⬜⬜🌲⬜⬜🌳⬜⬜🌲⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲⬜
⬜⬜⬜⬜🌳⬜⬜🌳⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
🪳🪳🪳🪳🪳🪳🪳🪳⬜⬜⬜
```
### `Locust`s spot a `tree` again
Timestep 8:
```
⬜⬜⬜🌲⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜🌲⬜⬜⬜⬜
⬜⬜⬜⬜🌳⬜⬜🌲⬜⬜⬜
⬜⬜🌲⬜⬜🌳⬜⬜🌲⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲⬜
⬜⬜⬜⬜🌳⬜⬜🌳⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜🌳⬜⬜⬜⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
🪳🪳🪳🪳🪳🪳🪳🪳🪳⬜⬜
```
Timestep 9:
```
⬜⬜⬜🌲⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜🌲⬜⬜⬜⬜
⬜⬜⬜⬜🌳⬜⬜🌲⬜⬜⬜
⬜⬜🌲⬜⬜🌳⬜⬜🌲⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲⬜
⬜⬜⬜⬜🌳⬜⬜🌳⬜⬜🌲
⬜⬜⬜⬜⬜⬜⬜⬜🌳⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜🌲
⬜⬜⬜⬜🪳🪳⬜⬜⬜⬜⬜
🪳🪳🪳🪳🪳🪳🪳🪳🪳🪳⬜
```
Well, the `locust`s were at least able to propagate northward by one square as a result of a spiral path taken by a `tree` reconnecting with them.
# Conclusion
While it is much less elegant than Conway's Game of Life with a glider, we see that it is possible in at least one case for a `tree` species that dislikes both other `tree`s and being eaten by `locust`s to at first escape the `locust`s, but then due to other `tree`s, take a spiral path back to the `locust`s, triggering the previous `locust`s to then move north slightly and hence discover new `tree`s in the future.
# Fin.
[Conversation on the Mastodon as always](
https://gamerplus.org/@screwlisp/114877650085448340) please. Is there an easy (and/or mathematical) way I could have gotten this simulation construction easier?