lifegame 0.3.18

A simple implementation of the classic cellular automaton, Conway's Game of Life.
use super::Filter;
use crate::biosquare::Cell;
use crossterm::style::Stylize;
use std::sync::LazyLock;

static DEAD: LazyLock<String> = LazyLock::new(|| ''.bold().dim().to_string());
static ALIVE: LazyLock<String> = LazyLock::new(|| ''.bold().to_string());

#[derive(Debug, PartialEq, Eq)]
pub struct Hanzi;

impl Filter for Hanzi {
    fn filter(&self, cell: Cell) -> &str {
        match cell {
            Cell::Dead => &DEAD,
            Cell::Alive => &ALIVE,
        }
    }
}