lykoss / lykos

Werewolf, the popular detective/social party game (a theme of Mafia)
https://werewolf.chat
Other
127 stars 63 forks source link

Clean up lover logic #517

Closed skizzerz closed 1 year ago

skizzerz commented 1 year ago

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.