This is going to be so straight forward, that I've no clue how to come up with an idea for this lol.
The idea is to create a graph and just solve the thing with dijkstra. In this graph, every field of the maps is represented as a node. Every node is connected to the nodes next to it and the node with the same index on the other map. For connections on the same map, the gravity is 1. For connections to the other map, the gravity is 3. And, voila, now we have a graph to run dijkstra on.
The blocks represent logic gates.
- White: NAND
- Red: NOT
- Blue: Just copies the signal
The idea is to just simulate™ these logic flows.