Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I still confused about your point. The segment optimization reduces the number of nodes being iterated over, but doesn't change much else.

A fully compacted belt can move in Factorio, but only when Factorio knows it can output into an open belt. You can have a whole chain of fully compacted belts move, so long as the last segment has an opening. This is handled just like the first algorithm in OP - moving one segment per iteration like a big caterpillar walking.

A loop is just a segment that outputs into its own input - it has a seam. Factorio can't move the belt because it doesn't see an open space. But one could still use the second algorithm, marking segments as immobile rather than tiles. This allows the loop to work without jamming, even with the optimization.



There isn't any seam once the belt is fully compacted. This saves a check per full belt per tick -- this adds up.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: