Minor cleanup
parent
35f6682b8d
commit
3bbaf26657
|
@ -45,7 +45,6 @@ impl DiffuseAgent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut max_dist = *dist.iter().max().unwrap();
|
let mut max_dist = *dist.iter().max().unwrap();
|
||||||
println!("{:?}", dist);
|
|
||||||
|
|
||||||
'outer: loop {
|
'outer: loop {
|
||||||
for i in 0..11 {
|
for i in 0..11 {
|
||||||
|
|
22
src/util.rs
22
src/util.rs
|
@ -69,4 +69,26 @@ impl Symb {
|
||||||
pub fn is_minus(&self) -> bool {
|
pub fn is_minus(&self) -> bool {
|
||||||
self == &Self::Minus
|
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,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue