Started working on optimizer
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ use crate::objective::Objective;
|
||||
mod card;
|
||||
mod icon_bitfield;
|
||||
mod objective;
|
||||
mod optimizer;
|
||||
|
||||
use card::Card;
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
5
canvas/src/optimizer.rs
Normal file
5
canvas/src/optimizer.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
use crate::{CriteriaCard, icon_bitfield::IconBitfield, objective::Objective};
|
||||
|
||||
fn draw_painting(cards: &[IconBitfield], obj: Vec<(&CriteriaCard, u8)>) -> [usize; 3] {
|
||||
todo!()
|
||||
}
|
||||
Reference in New Issue
Block a user