This gets rid of a lot of nested loops by making proper use of the adjacency list datastructure already in place to traverse through the lovers graph. A second graph containing forward edges only is maintained for revealroles and endgame display, so that the main lovers graph can be pruned as people die and therefore simplify a lot of other logic.
For the second graph, we map in order of lower accountname to higher accountname, since this is guaranteed to be stable throughout the course of a game.
This gets rid of a lot of nested loops by making proper use of the adjacency list datastructure already in place to traverse through the lovers graph. A second graph containing forward edges only is maintained for revealroles and endgame display, so that the main lovers graph can be pruned as people die and therefore simplify a lot of other logic.
For the second graph, we map in order of lower accountname to higher accountname, since this is guaranteed to be stable throughout the course of a game.