Open alexmitchell opened 1 year ago
@kalekundert Is there a reason the "control" attribute of map nodes is a list rather than an integer? The attribute is created in the compose_map function in seacow.py (lines 354-382 in my version). There can only be one owner at a time, correct?
If we keep the list, would the last element be the current owner?
The list is needed to know which player controlled the tile on past turns. For example, if I were to explore a tile on turn 3, and you were to take control of it on turn 4, my map should continue to show it as uncontrolled, because that's how it was at the time I explored it. In order for this to work, the game needs to track (i) what turn each explore action was taken and (ii) what turn any visible changes to the map happened.
The list is a collection of Control
objects, where each control object has turn
and player
attributes, so the current owner is map.nodes[tile]['control'][-1].player
. (Of course, the list could also be empty, indicating that neither player controls the tile.) This logic is implemented by seacow.who_controls()
, though, so you don't need to do it yourself.
Now that I think about it, there should also be a variant on that function, maybe called seacow.who_controlled()
, that calculates who controlled a tile on a given turn. That would be useful for some of this map stuff.
Great! Thanks for the fast clarification! I see why a list is needed.
I completely missed that there is a Control class in the file. haha
Wishlist:
Docs for shape of the node: https://graphviz.org/docs/attrs/shape/
Docs for labels: https://graphviz.org/docs/attrs/label/