Open HighDiceRoller opened 1 year ago
Somewhat ambitious idea:
OutcomeCountGenerator
into two objects: a base multiset, and a operation acyclic digraph that pulls counts from that multiset.Deck
would be an example of a multiset. We could potentially even consider Pool
to be a distribution over multisets and allow to "deal" dice from the result, though the practical use cases for this seem to be limited.Potential syntax:
a, b = deck.draw(5, 5) # a, b are considered to be drawn from the same deck
# probably not mandatory to use them all at the same time
# but if we do another draw it's considered to be from a fresh deck
(a & b).sum() # a & b creates an intersection puller, which can then be sent to SumEvaluator()
# but what if:
evaluator.evaluate(a & b, a | b)
# how many hands are pulled, two or four?
# also
evaluator.evaluate(d6.pool(6), d6.pool(6))
# are the pools the same or independent?
Puller interface:
next_state
we need to generate the following:
Evaluation:
Arguments against:
apply
, map
, evaluate
etc. and treating objects as independent otherwise. It's nice not to have to think about "spooky action at a distance".Decided not to pursue this at this time.
Thinking about this again. I don't really like the way Deal
occupies multiple slots at the moment, and it makes it hard to do things like
a, b = deck.deal(3, 3)
print((a - b).count())
This would require some way of querying the deal for multiple hands at a time.
Count generation process for two hands:
generate
frompop
.Questions:
itertools.product
.sample
?