Comment by collabs
1 day ago
The way I think of it, divide the tracks into segments. Before you put a train on a segment, you must ask a question - is there a train on it. There are only two answers possible, No, and something else. If it is something else, stop. Don't let the train on that segment.
There are optimizations possible like make segments smaller etc but the original algorithm is trivial. If we can't figure things out, we make segments longer and we slow down the trains until we can. I am positive for a sufficiently large track segment and a sufficiently slow train, we can always answer the question with a no.
You've "invented" interlocking railway semaphores, after which the computer science concept was named.
https://en.wikipedia.org/wiki/Railway_semaphore_signal
https://en.wikipedia.org/wiki/Interlocking
Congratulation you are reinventing 1890 state of the art.
The problem is when the modern computer-dependent system replaces the ancient one, and so then the computer is down there is nothing at all.
Actually in this case it seemed that the opposite was the case, there was another fallback system, but you needed to disregard it, and operate manually, but the operators likely didn't notice that. https://news.ycombinator.com/item?id=50298796
Which is why you generally don't do that.