modes:single: implement Hand for Singles
Really trivial implementation.
This commit is contained in:
@@ -9,6 +9,24 @@ impl Single {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use crate::helper::ordered;
|
||||||
|
use crate::modes::{Footstool, Hand};
|
||||||
|
|
||||||
|
impl Hand for Single {
|
||||||
|
fn footstool(&self, other: Self) -> Footstool {
|
||||||
|
let self_abs = self.0.deck_abs();
|
||||||
|
let other_abs = other.0.deck_abs();
|
||||||
|
|
||||||
|
if self_abs == other_abs {
|
||||||
|
Footstool::Full
|
||||||
|
} else if self_abs == other_abs + 1 {
|
||||||
|
Footstool::Half
|
||||||
|
} else {
|
||||||
|
Footstool::None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
use std::fmt::{Display, Formatter, Result};
|
use std::fmt::{Display, Formatter, Result};
|
||||||
impl Display for Single {
|
impl Display for Single {
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
|
||||||
|
|||||||
Reference in New Issue
Block a user