For example, consider a game in which a player controls a set of indices, and one category of legal moves is to expand to a index adjacent to the controlled set. I want to get a collection of legal moves. In principle, I could take neighbors of each of these, union them, and subtract the initial set, but there may be a better way with access to internals.
Relatedly, I may want to ask if two sets are adjacent to each other.
I realize this may be feature creep, but I came across a situation where I needed similar functionality, so I mention it here.
For example, consider a game in which a player controls a set of indices, and one category of legal moves is to expand to a index adjacent to the controlled set. I want to get a collection of legal moves. In principle, I could take neighbors of each of these, union them, and subtract the initial set, but there may be a better way with access to internals.
Relatedly, I may want to ask if two sets are adjacent to each other.
I realize this may be feature creep, but I came across a situation where I needed similar functionality, so I mention it here.