mjpieters / RummikubConsole

Rummikub solver console with multi-game support and persistence.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when setting number of jokers greater than 2

erik-overdahl opened this issue · comments

When launching with --jokers 3 or --jokers 4, I get a crash with traceback

...
  File "/home/francis/Scratch/rummikub/.venv/lib64/python3.12/site-packages/rummikubconsole/__main__.py", line 65, in rsconsole
    ruleset = RuleSet(
              ^^^^^^^^
  File "/home/francis/Scratch/rummikub/.venv/lib64/python3.12/site-packages/rummikubconsole/ruleset.py", line 37, in __init__
    self._solver = RummikubSolver(self)
                   ^^^^^^^^^^^^^^^^^^^^
  File "/home/francis/Scratch/rummikub/.venv/lib64/python3.12/site-packages/rummikubconsole/solver.py", line 107, in __init__
    setvalue = np.array(ruleset.setvalues, dtype=np.uint16)
                        ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.12/functools.py", line 995, in __get__
    val = self.func(instance)
          ^^^^^^^^^^^^^^^^^^^
  File "/home/francis/Scratch/rummikub/.venv/lib64/python3.12/site-packages/rummikubconsole/ruleset.py", line 158, in setvalues
    return [_calc(set) for set in self.sets]
            ^^^^^^^^^^
  File "/home/francis/Scratch/rummikub/.venv/lib64/python3.12/site-packages/rummikubconsole/ruleset.py", line 147, in _calc
    n0 = _next(nums)
         ^^^^^^^^^^^
StopIteration

Ah, yes, I see why that happens. With 3 or more jokers you can create an arbitrary group or set, and that's not something you can score easily. I'll have to give this a bit of a think.

Thanks for the report, this is now fixed and part of version 1.2.5 🎉