Hello! I'm trying to write a rust version of a Python library I've written for brute forcing solutions to a game mode in Teamfight Tactics, a League of Legends game. The Python solution to my question is here.
In the game, champions have 1-3 traits, like Warrior or Scholar, and if you put two Warriors out on the map, the Warriors 2 trait will activate. The problem I'm trying to solve involves figuring out which champions to place on the map in order to activate 7 different traits, preferably with as few champions as possible.
To represent my champions I have in Python written an enum that has values Traits, cost. For instance, for the champion called Ahri:
@dataclass
class ChampionTraits:
traits: set[Trait]
cost: int
class Champion(ChampionTraits, Enum):
Ahri = {Trait.Arcana, Trait.Scholar}, 2
# (59 more below)
In rust, I tried creating the following struct and enum:
struct Champion {
traits: Vec<Trait>,
cost: u8,
}
enum ChampionEnum {
Ahri = Champion {
traits: vec![Trait.Arcana, Trait.Scholar],
cost: 2,
},
}
but I'm realizing that enums don't work this way. A key part here is that there are (only) 60 well defined champions, and I won't be needing to create custom ones. So, a const AHRI might make sense, but I thought I'd check here first, since I'm still very new to rust.
Does anyone have a suggestion for a good data structure to use?