Minor cleanup

master
Mark 2024-03-03 22:10:12 -08:00
parent 35f6682b8d
commit 3bbaf26657
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
2 changed files with 22 additions and 1 deletions

View File

@ -45,7 +45,6 @@ impl DiffuseAgent {
}
}
let mut max_dist = *dist.iter().max().unwrap();
println!("{:?}", dist);
'outer: loop {
for i in 0..11 {

View File

@ -69,4 +69,26 @@ impl Symb {
pub fn is_minus(&self) -> bool {
self == &Self::Minus
}
pub fn from_char(c: &char) -> Option<Self> {
match c {
'1' => Some(Self::Number(NonZeroU8::new(1).unwrap())),
'2' => Some(Self::Number(NonZeroU8::new(2).unwrap())),
'3' => Some(Self::Number(NonZeroU8::new(3).unwrap())),
'4' => Some(Self::Number(NonZeroU8::new(4).unwrap())),
'5' => Some(Self::Number(NonZeroU8::new(5).unwrap())),
'6' => Some(Self::Number(NonZeroU8::new(6).unwrap())),
'7' => Some(Self::Number(NonZeroU8::new(7).unwrap())),
'8' => Some(Self::Number(NonZeroU8::new(8).unwrap())),
'9' => Some(Self::Number(NonZeroU8::new(9).unwrap())),
'0' => Some(Self::Zero),
'+' => Some(Self::Plus),
'-' => Some(Self::Minus),
'*' => Some(Self::Times),
'/' => Some(Self::Div),
'×' => Some(Self::Times),
'÷' => Some(Self::Div),
_ => None,
}
}
}