use bevy::{math::UVec2, platform::collections::HashSet};
pub(crate) enum MatchDirection {
Horizontal,
Vertical,
}
#[derive(Clone, Debug)]
pub enum Match {
Straight(HashSet<UVec2>),
}
#[derive(Default, Clone, Debug)]
pub struct Matches {
pub(crate) matches: Vec<Match>,
}
impl Matches {
pub(crate) fn add(&mut self, mat: Match) {
self.matches.push(mat)
}
pub(crate) fn append(&mut self, other: &mut Matches) {
self.matches.append(&mut other.matches);
}
pub fn without_duplicates(&self) -> HashSet<UVec2> {
self.matches
.iter()
.flat_map(|mat| match mat {
Match::Straight(mat) => mat,
})
.cloned()
.collect()
}
pub(crate) fn is_empty(&self) -> bool {
self.matches.is_empty()
}
}