From d0a324cd0db5f6d264778fc3d4df67c4bc71d88c Mon Sep 17 00:00:00 2001 From: MA Beaudet Date: Wed, 10 Nov 2021 12:08:41 +0100 Subject: [PATCH] fix!: change methods `eval_5hand` `eval_7hand` to associated functions --- src/evaluator.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/evaluator.rs b/src/evaluator.rs index ce492d7..696c7ee 100644 --- a/src/evaluator.rs +++ b/src/evaluator.rs @@ -91,16 +91,16 @@ impl Evaluator { Rules::Classic => hands .iter() .map(|h| match self.algorithm { - Algorithm::CactusKev => self.eval_5hand(h.as_slice()).unwrap(), + Algorithm::CactusKev => Evaluator::eval_5hand(h.as_slice()).unwrap(), }) .enumerate() .collect(), Rules::Holdem => hands .into_iter() .map(|h| match self.algorithm { - Algorithm::CactusKev => self - .eval_7hand([h, table.clone()].concat().as_slice()) - .unwrap(), + Algorithm::CactusKev => { + Evaluator::eval_7hand([h, table.clone()].concat().as_slice()).unwrap() + } }) .enumerate() .collect(), @@ -108,7 +108,7 @@ impl Evaluator { Ok(result) } - pub fn eval_5hand(&self, cards: &[u32]) -> Result { + pub fn eval_5hand(cards: &[u32]) -> Result { if let [c1, c2, c3, c4, c5] = cards[..5] { let q = (c1 | c2 | c3 | c4 | c5) >> 16; if c1 & c2 & c3 & c4 & c5 & 0xF000 != 0 { @@ -125,7 +125,7 @@ impl Evaluator { } /// Non-optimized method of determining the best five-card hand possible of seven cards. - pub fn eval_7hand(&self, cards: &[u32]) -> Result { + pub fn eval_7hand(cards: &[u32]) -> Result { let mut subhand: [u32; 5] = [0; 5]; let mut best = 9999; @@ -133,7 +133,7 @@ impl Evaluator { for j in 0..5 { subhand[j] = cards[..][PERM7[i][j] as usize]; } - let q = self.eval_5hand(&subhand)?; + let q = Evaluator::eval_5hand(&subhand)?; if q < best { best = q; } -- 2.20.1