ctm / mb2-doc

Mb2, poker software
https://devctm.com
7 stars 2 forks source link

PLO Broke #1282

Closed ctm closed 6 months ago

ctm commented 6 months ago

Fix PLO to work again.

When I fixed Double Board PLO (#1277), I broke regular (single board) Omaha:

2024-01-16T01:12:14.497975673Z thread '<unnamed>' panicked at lib/commands/src/game/omaha.rs:35:25:
2024-01-16T01:12:14.498532921Z removal index (is 1) should be < len (is 1)
    fn board_indices(&self, winner_index: usize) -> Vec<Vec<usize>> {
        let mut indices = Deal::double_board_indices(self.double_board);
        if !self.is_split_pot() {
            if winner_index == 0 {
                indices.remove(1);
ctm commented 6 months ago
diff --git a/lib/commands/src/game/omaha.rs b/lib/commands/src/game/omaha.rs
index 5582a901..c0bfe491 100644
--- a/lib/commands/src/game/omaha.rs
+++ b/lib/commands/src/game/omaha.rs
@@ -30,7 +30,7 @@ impl BoxedGameGroup for Omaha {
 impl Omaha {
     fn board_indices(&self, winner_index: usize) -> Vec<Vec<usize>> {
         let mut indices = Deal::double_board_indices(self.double_board);
-        if !self.is_split_pot() {
+        if indices.len() == 2 && !self.is_split_pot() {
             if winner_index == 0 {
                 indices.remove(1);
             } else {

Deploying now.