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(),
Ok(result)
}
- pub fn eval_5hand(&self, cards: &[u32]) -> Result<u16, MyError> {
+ pub fn eval_5hand(cards: &[u32]) -> Result<u16, MyError> {
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 {
}
/// Non-optimized method of determining the best five-card hand possible of seven cards.
- pub fn eval_7hand(&self, cards: &[u32]) -> Result<u16, MyError> {
+ pub fn eval_7hand(cards: &[u32]) -> Result<u16, MyError> {
let mut subhand: [u32; 5] = [0; 5];
let mut best = 9999;
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;
}