From 92348bc2c3c9571658d238272f021285caf5bf81 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 1 Apr 2026 05:42:16 +0100 Subject: [PATCH] classifier: move hand types to their own module --- src/classifier.rs | 29 ++--------------------------- src/hand.rs | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 27 deletions(-) create mode 100644 src/hand.rs diff --git a/src/classifier.rs b/src/classifier.rs index 1382ee5..a608871 100644 --- a/src/classifier.rs +++ b/src/classifier.rs @@ -1,30 +1,5 @@ -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, - }, -} +use crate::card::{Card, Rank}; +use crate::hand::{Hand, PokerType}; impl Hand { // Stupid shorthand method of generating poker hands diff --git a/src/hand.rs b/src/hand.rs new file mode 100644 index 0000000..f03e9be --- /dev/null +++ b/src/hand.rs @@ -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, + }, +}