Skip to content

Commit

Permalink
rename pointwise_highest to pointwise_max
Browse files Browse the repository at this point in the history
  • Loading branch information
HighDiceRoller committed Oct 13, 2024
1 parent ea1f884 commit 64eb072
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/icepool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

from icepool.function import (d, z, __getattr__, coin, stochastic_round,
one_hot, iter_cartesian_product, from_cumulative,
from_rv, pointwise_highest, pointwise_lowest, min_outcome,
from_rv, pointwise_max, pointwise_min, min_outcome,
max_outcome, consecutive, sorted_union,
commonize_denominator, reduce, accumulate, map,
map_function, map_and_time, map_to_pool)
Expand Down Expand Up @@ -147,7 +147,7 @@
'd', 'z', 'coin', 'stochastic_round', 'one_hot', 'Outcome', 'Die',
'Population', 'tupleize', 'vectorize', 'Vector', 'Symbols', 'Again',
'CountsKeysView', 'CountsValuesView', 'CountsItemsView', 'from_cumulative',
'from_rv', 'pointwise_highest', 'pointwise_lowest', 'lowest', 'highest', 'middle', 'min_outcome', 'max_outcome',
'from_rv', 'pointwise_max', 'pointwise_min', 'lowest', 'highest', 'middle', 'min_outcome', 'max_outcome',
'consecutive', 'sorted_union', 'commonize_denominator', 'reduce',
'accumulate', 'map', 'map_function', 'map_and_time', 'map_to_pool',
'Reroll', 'RerollType', 'Pool', 'standard_pool', 'MultisetGenerator',
Expand Down
12 changes: 6 additions & 6 deletions src/icepool/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ def _iter_outcomes(
yield arg

@overload
def pointwise_highest(arg0: 'Iterable[icepool.Die[T]]', /,) -> 'icepool.Die[T]':
def pointwise_max(arg0: 'Iterable[icepool.Die[T]]', /,) -> 'icepool.Die[T]':
...

@overload
def pointwise_highest(arg0: 'icepool.Die[T]', arg1: 'icepool.Die[T]', /, *args: 'icepool.Die[T]') -> 'icepool.Die[T]':
def pointwise_max(arg0: 'icepool.Die[T]', arg1: 'icepool.Die[T]', /, *args: 'icepool.Die[T]') -> 'icepool.Die[T]':
...

def pointwise_highest(arg0, /, *more_args: 'icepool.Die[T]') -> 'icepool.Die[T]':
def pointwise_max(arg0, /, *more_args: 'icepool.Die[T]') -> 'icepool.Die[T]':
"""Selects the highest chance of rolling >= each outcome among the arguments.
Naming not finalized.
Expand Down Expand Up @@ -273,14 +273,14 @@ def pointwise_highest(arg0, /, *more_args: 'icepool.Die[T]') -> 'icepool.Die[T]'
return from_cumulative(outcomes, cumulative)

@overload
def pointwise_lowest(arg0: 'Iterable[icepool.Die[T]]', /,) -> 'icepool.Die[T]':
def pointwise_min(arg0: 'Iterable[icepool.Die[T]]', /,) -> 'icepool.Die[T]':
...

@overload
def pointwise_lowest(arg0: 'icepool.Die[T]', arg1: 'icepool.Die[T]', /, *args: 'icepool.Die[T]') -> 'icepool.Die[T]':
def pointwise_min(arg0: 'icepool.Die[T]', arg1: 'icepool.Die[T]', /, *args: 'icepool.Die[T]') -> 'icepool.Die[T]':
...

def pointwise_lowest(arg0, /, *more_args: 'icepool.Die[T]') -> 'icepool.Die[T]':
def pointwise_min(arg0, /, *more_args: 'icepool.Die[T]') -> 'icepool.Die[T]':
"""Selects the highest chance of rolling <= each outcome among the arguments.
Naming not finalized.
Expand Down
18 changes: 9 additions & 9 deletions tests/function_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import icepool
import pytest

from icepool import d4, d6, d8, d10, d12, d20, min_outcome, max_outcome, pointwise_highest, pointwise_lowest
from icepool import d4, d6, d8, d10, d12, d20, min_outcome, max_outcome, pointwise_max, pointwise_min


def test_min_outcome_single_arg():
Expand All @@ -27,29 +27,29 @@ def test_max_outcome_multiple_arg():
def test_max_outcome_bare_outcome():
assert max_outcome(d6, d8, 10, 2) == 10

def test_pointwise_highest():
result = pointwise_highest(3 @ d6, d20)
def test_pointwise_max():
result = pointwise_max(3 @ d6, d20)
for outcome in range(1, 21):
assert result.probability('>=', outcome) == max(
(3 @ d6).probability('>=', outcome),
d20.probability('>=', outcome))

def test_pointwise_highest_single_argument():
result = pointwise_highest([3 @ d6, d20])
def test_pointwise_max_single_argument():
result = pointwise_max([3 @ d6, d20])
for outcome in range(1, 21):
assert result.probability('>=', outcome) == max(
(3 @ d6).probability('>=', outcome),
d20.probability('>=', outcome))

def test_pointwise_lowest():
result = pointwise_lowest(3 @ d6, d20)
def test_pointwise_min():
result = pointwise_min(3 @ d6, d20)
for outcome in range(1, 21):
assert result.probability('<=', outcome) == max(
(3 @ d6).probability('<=', outcome),
d20.probability('<=', outcome))

def test_pointwise_lowest_single_argument():
result = pointwise_lowest([3 @ d6, d20])
def test_pointwise_min_single_argument():
result = pointwise_min([3 @ d6, d20])
for outcome in range(1, 21):
assert result.probability('<=', outcome) == max(
(3 @ d6).probability('<=', outcome),
Expand Down

0 comments on commit 64eb072

Please sign in to comment.