use crate::frame::scored::ScoredFrame;
#[derive(Debug, Clone)]
pub struct ScoreCard {
frames: Vec<ScoredFrame>,
}
impl ScoreCard {
pub(crate) fn new() -> Self {
Self {
frames: Vec::with_capacity(12),
}
}
pub fn frames(&self) -> &[ScoredFrame] {
&self.frames
}
pub(crate) fn push_frame(&mut self, frame: ScoredFrame) {
self.frames.push(frame);
}
pub fn frames_completed(&self) -> u8 {
#[expect(
clippy::cast_possible_truncation,
reason = "frame count is always <= 255"
)]
{
self.frames.len() as u8
}
}
}