modes:triples: deleted
Way more work needs to be put into the internals of this codebase before I can continue work on the classifier, so I'm going to focus on that. Might be time for a merge.
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
pub mod pair;
|
pub mod pair;
|
||||||
pub mod single;
|
pub mod single;
|
||||||
pub mod triple;
|
|
||||||
|
|
||||||
#[derive(Eq, Ord, PartialEq, PartialOrd, Debug, Copy, Clone)]
|
#[derive(Eq, Ord, PartialEq, PartialOrd, Debug, Copy, Clone)]
|
||||||
pub enum Footstool {
|
pub enum Footstool {
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
use crate::{
|
|
||||||
card::{Card, PlayingCard},
|
|
||||||
helper::ordered,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[derive(Debug, Copy, Clone)]
|
|
||||||
pub struct Triple(pub Card, pub Card, pub Card);
|
|
||||||
|
|
||||||
impl Triple {
|
|
||||||
fn new(c1: Card, c2: Card, c3: Card) -> Option<Triple> {
|
|
||||||
let [c1, c2, c3] = ordered([c1, c2, c3]);
|
|
||||||
|
|
||||||
match (c1, c2, c3) {
|
|
||||||
// Invalid triple if you have 3 jokers
|
|
||||||
(Card::Joker(_), Card::Joker(_), Card::Joker(_)) => None,
|
|
||||||
|
|
||||||
// NOTE: c3 cannot be a joker now. If the other two cards are
|
|
||||||
// jokers, then this is fine as a triple.
|
|
||||||
(Card::Joker(_), Card::Joker(_), _) => Some(Triple(c1, c2, c3)),
|
|
||||||
|
|
||||||
// NOTE: c2 cannot be a joker now. If only one card is a joker, the
|
|
||||||
// other two card's ranks must match.
|
|
||||||
(
|
|
||||||
Card::Joker(_),
|
|
||||||
Card::PlayingCard(PlayingCard { rank: r2, .. }),
|
|
||||||
Card::PlayingCard(PlayingCard { rank: r3, .. }),
|
|
||||||
) if r2 == r3 => Some(Triple(c1, c2, c3)),
|
|
||||||
|
|
||||||
// NOTE: all cards are playing cards. All ranks must match in order
|
|
||||||
// to be a triple.
|
|
||||||
(
|
|
||||||
Card::PlayingCard(PlayingCard { rank: r1, .. }),
|
|
||||||
Card::PlayingCard(PlayingCard { rank: r2, .. }),
|
|
||||||
Card::PlayingCard(PlayingCard { rank: r3, .. }),
|
|
||||||
) if r1 == r2 && r2 == r3 => Some(Triple(c1, c2, c3)),
|
|
||||||
|
|
||||||
// Once again, not necessary since the previous patterns should
|
|
||||||
// encapsulate all possible combinations due to ordering, but the
|
|
||||||
// compiler needs the juice.
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user