Started working on optimizer

This commit is contained in:
Lukas Wölfer
2025-07-26 14:33:28 +02:00
parent cad18c3249
commit e23e0b8cde
3 changed files with 12 additions and 4 deletions

View File

@@ -13,7 +13,7 @@ pub(crate) struct IconBitfield {
}
impl IconBitfield {
pub(crate) fn get_icon_bits(&self, icon: Icon) -> u8 {
pub fn get_icon_bits(&self, icon: Icon) -> u8 {
match icon {
Icon::Circle => self.circle,
Icon::Square => self.square,
@@ -21,11 +21,11 @@ impl IconBitfield {
Icon::Color => self.color,
}
}
pub(crate) fn get_point_bits(&self) -> u8 {
pub fn get_point_bits(&self) -> u8 {
self.points
}
pub(crate) fn add_icon(&mut self, icon: Icon, index: u8) {
fn add_icon(&mut self, icon: Icon, index: u8) {
let field = match icon {
Icon::Circle => &mut self.circle,
Icon::Square => &mut self.square,
@@ -46,11 +46,12 @@ impl IconBitfield {
CardField::Empty => (),
}
}
pub fn new(card: &Card) -> Self {
let mut result = Self::default();
(0u8..)
.zip(card.field.iter())
.for_each(|(index, field)| result.add_field(field.clone(), index));
.for_each(|(index, field)| result.add_field(*field, index));
result
}