Skip to content

*Donjon* / *Sorcerer* mechanic #248

@HighDiceRoller

Description

@HighDiceRoller

The mechanic

Two sides each roll a pool of dice and sort them highest to lowest. Starting from the top, set aside ties until a non-matching pair is found. The side with the higher die in that pair wins, scoring one success for each of their dice (including the set-aside high-ties) that are greater than the losing die in that pair.

Other efforts to compute probability

Possible APIs

If iterating in the favorable direction (descending in the above case), we could make this an expression where we emit elements until we find an unpaired element, then keep emitting until we find the corresponding paired element. However, the expression doesn't know who wins until later, so we would still have to separately specify the winner. So the solution in this case would look like

@multiset_function
def example(a, b):
    return a.donjon(b).size(), a.leximax('>', b)

Could this be done using existing components?

@multiset_function
def donjon(a, b):
    return a.versus_all('>', b - a).size(), b.versus_all('>', a - b).size()

doesn't quite work, since the highest losing die could be erroneously deleted by a winning die down the line.

Variations

  • Emit from pairs meeting a comparison, until the first time another comparison is met.
    • Same, but starting from the first time another comparison is met.
    • Annoyingly we may need to specify whether this is inclusive of the triggering pair. So we might not want to jam them all into the same method.
    • What should be the default behavior with extra elements?
  • Separate expression / evaluator type with a next_state that takes pairs etc.?
    • Unfortunately I don't think this works from an efficiency perspective: if one side appears much later than the other, the earlier side is going to pile up an expand()-sized amount of state. The comparators are efficient because they only need to know that one side appeared earlier or later without knowing the exact value of the other side.
    • What if we only emitted cmp for each pair?
  • A version of sort_pair that accepts and/or returns a 2-tuple? I'm not sure how I feel about more tuples outside of multiset_function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions