classifier: move hand types to their own module
This commit is contained in:
@@ -1,30 +1,5 @@
|
|||||||
use crate::Card;
|
use crate::card::{Card, Rank};
|
||||||
|
use crate::hand::{Hand, PokerType};
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum PokerType {
|
|
||||||
TwoPair,
|
|
||||||
Flush,
|
|
||||||
Straight,
|
|
||||||
FullHouse,
|
|
||||||
FourKind,
|
|
||||||
FiveKind,
|
|
||||||
StraightFlush,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum Hand {
|
|
||||||
Single(Card),
|
|
||||||
Pair(Card, Card),
|
|
||||||
Triple(Card, Card, Card),
|
|
||||||
Poker {
|
|
||||||
poker_type: PokerType,
|
|
||||||
c1: Card,
|
|
||||||
c2: Card,
|
|
||||||
c3: Card,
|
|
||||||
c4: Card,
|
|
||||||
c5: Card,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Hand {
|
impl Hand {
|
||||||
// Stupid shorthand method of generating poker hands
|
// Stupid shorthand method of generating poker hands
|
||||||
|
|||||||
27
src/hand.rs
Normal file
27
src/hand.rs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
use crate::Card;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum PokerType {
|
||||||
|
TwoPair,
|
||||||
|
Flush,
|
||||||
|
Straight,
|
||||||
|
FullHouse,
|
||||||
|
FourKind,
|
||||||
|
FiveKind,
|
||||||
|
StraightFlush,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Hand {
|
||||||
|
Single(Card),
|
||||||
|
Pair(Card, Card),
|
||||||
|
Triple(Card, Card, Card),
|
||||||
|
Poker {
|
||||||
|
poker_type: PokerType,
|
||||||
|
c1: Card,
|
||||||
|
c2: Card,
|
||||||
|
c3: Card,
|
||||||
|
c4: Card,
|
||||||
|
c5: Card,
|
||||||
|
},
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user