Function aoc::year2021::day23::deadlock_room

source ·
fn deadlock_room(burrow: &Burrow, kind: usize) -> bool
Expand description

Detects situation where amphipods in the hallway need to move past each other but mutually block any further progress.

For example:

    #############
    #.....D.A...#
    ###.#.#.#.###
      #.#.#.#.#
      #.#.#C#.#
      #.#.#C#.#
      #########

In this situation, neither A nor D can move into C’s room but also block each other from returning to their home burrow.

Another example:

    #############
    #.....C.A...#
    ###.#.#.#.###
      #.#.#.#.#
      #.#.#B#.#
      #.#.#C#.#
      #########

In this situation C blocks A from returning to its home burrow and B is also blocked from moving out of the way.