crapssim.bet

Attributes

ALL_DICE_NUMBERS

Classes

TableSettings

dict() -> new empty dictionary

Table

Base class for protocol classes.

Player

Base class for protocol classes.

BetResult

_MetaBetABC

Metaclass for defining Abstract Base Classes (ABCs).

Bet

A generic bet for the craps table

_WinningLosingNumbersBet

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios

_SimpleBet

A _SimpleBet has fixed winning and losing numbers and payout ratio that

PassLine

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios

Come

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios

DontPass

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios

DontCome

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios

Odds

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios

Place

A _SimpleBet has fixed winning and losing numbers and payout ratio that

Field

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios

CAndE

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios

Any7

A _SimpleBet has fixed winning and losing numbers and payout ratio that

Two

A _SimpleBet has fixed winning and losing numbers and payout ratio that

Three

A _SimpleBet has fixed winning and losing numbers and payout ratio that

Yo

A _SimpleBet has fixed winning and losing numbers and payout ratio that

Boxcars

A _SimpleBet has fixed winning and losing numbers and payout ratio that

AnyCraps

A _SimpleBet has fixed winning and losing numbers and payout ratio that

HardWay

A generic bet for the craps table

Fire

A generic bet for the craps table

_ATSBet

Class representing ATS (All, Tall, Small) bets, not a usable bet by itself.

All

Class representing ATS (All, Tall, Small) bets, not a usable bet by itself.

Tall

Class representing ATS (All, Tall, Small) bets, not a usable bet by itself.

Small

Class representing ATS (All, Tall, Small) bets, not a usable bet by itself.

Module Contents

crapssim.bet.ALL_DICE_NUMBERS
class crapssim.bet.TableSettings

Bases: TypedDict

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object’s

(key, value) pairs

dict(iterable) -> new dictionary initialized as if via:

d = {} for k, v in iterable:

d[k] = v

dict(**kwargs) -> new dictionary initialized with the name=value pairs

in the keyword argument list. For example: dict(one=1, two=2)

ATS_payouts: dict[str, int]
field_payouts: dict[int, int]
fire_payouts: dict[int, int]
max_odds: dict[int, int]
max_dont_odds: dict[int, int]
class crapssim.bet.Table

Bases: Protocol

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto(Protocol[T]):
    def meth(self) -> T:
        ...
dice: crapssim.dice.Dice
point: crapssim.point.Point
settings: TableSettings
class crapssim.bet.Player

Bases: Protocol

Base class for protocol classes.

Protocol classes are defined as:

class Proto(Protocol):
    def meth(self) -> int:
        ...

Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:

class C:
    def meth(self) -> int:
        return 0

def func(x: Proto) -> int:
    return x.meth()

func(C())  # Passes static type check

See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:

class GenProto(Protocol[T]):
    def meth(self) -> T:
        ...
table: Table
bets: list[Type[Bet]]
class crapssim.bet.BetResult
amount: float
remove: bool
property won: bool
property lost: bool
property pushed: bool
property bankroll_change: float
class crapssim.bet._MetaBetABC

Bases: abc.ABCMeta

Metaclass for defining Abstract Base Classes (ABCs).

Use this metaclass to create an ABC. An ABC can be subclassed directly, and then acts as a mix-in class. You can also register unrelated concrete classes (even built-in classes) and unrelated ABCs as ‘virtual subclasses’ – these and their descendants will be considered subclasses of the registering ABC by the built-in issubclass() function, but the registering ABC won’t show up in their MRO (Method Resolution Order) nor will method implementations defined by the registering ABC be callable (not even via super()).

__repr__()
class crapssim.bet.Bet(amount: SupportsFloat)

Bases: abc.ABC

A generic bet for the craps table

Parameters:

amount (SupportsFloat) – Wagered amount for the bet

amount

Wagered amount for the bet

Type:

float

amount: float
abstract get_result(table: Table) BetResult
update_number(table: Table)
is_removable(table: Table) bool
is_allowed(player: Player) bool

Checks whether the bet is allowed to be placed on the given table. May depend on the player’s bets also (e.g. for odds bets).

Parameters:

player

Returns:

True if the bet is allowed, otherwise false.

Return type:

bool

property _placed_key: Hashable
property _hash_key: Hashable
__eq__(other: object) bool
__hash__() int
__repr__() str
__add__(other: Bet) Bet
__radd__(other)
__sub__(other: Bet) Bet
__rsub__(other)
class crapssim.bet._WinningLosingNumbersBet(amount: SupportsFloat)

Bases: Bet, abc.ABC

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios (possibly depending on the table) from which the result can be calculated.

get_result(table: Table) BetResult
abstract get_winning_numbers(table: Table) list[int]
abstract get_losing_numbers(table: Table) list[int]
abstract get_payout_ratio(table: Table) float
class crapssim.bet._SimpleBet(amount: SupportsFloat)

Bases: _WinningLosingNumbersBet, abc.ABC

A _SimpleBet has fixed winning and losing numbers and payout ratio that can be known at instantiation and don’t depend on the table.

winning_numbers: list[int] = []
losing_numbers: list[int] = []
payout_ratio: int = 1
get_winning_numbers(table: Table) list[int]
get_losing_numbers(table: Table) list[int]
get_payout_ratio(table: Table) float
class crapssim.bet.PassLine(amount: SupportsFloat)

Bases: _WinningLosingNumbersBet

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios (possibly depending on the table) from which the result can be calculated.

get_winning_numbers(table: Table) list[int]
get_losing_numbers(table: Table) list[int]
get_payout_ratio(table: Table) float
is_removable(table: Table) bool
is_allowed(player: Player) bool

Checks whether the bet is allowed to be placed on the given table. May depend on the player’s bets also (e.g. for odds bets).

Parameters:

player

Returns:

True if the bet is allowed, otherwise false.

Return type:

bool

class crapssim.bet.Come(amount: SupportsFloat, number: int | None = None)

Bases: _WinningLosingNumbersBet

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios (possibly depending on the table) from which the result can be calculated.

get_winning_numbers(table: Table) list[int]
get_losing_numbers(table: Table) list[int]
get_payout_ratio(table: Table) float
update_number(table: Table)
is_removable(table: Table) bool
is_allowed(player: Player) bool

Checks whether the bet is allowed to be placed on the given table. May depend on the player’s bets also (e.g. for odds bets).

Parameters:

player

Returns:

True if the bet is allowed, otherwise false.

Return type:

bool

property _placed_key: Hashable
__repr__() str
class crapssim.bet.DontPass(amount: SupportsFloat)

Bases: _WinningLosingNumbersBet

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios (possibly depending on the table) from which the result can be calculated.

get_winning_numbers(table: Table) list[int]
get_losing_numbers(table: Table) list[int]
get_payout_ratio(table: Table) float
is_allowed(player: Player) bool

Checks whether the bet is allowed to be placed on the given table. May depend on the player’s bets also (e.g. for odds bets).

Parameters:

player

Returns:

True if the bet is allowed, otherwise false.

Return type:

bool

class crapssim.bet.DontCome(amount: SupportsFloat, number: int | None = None)

Bases: _WinningLosingNumbersBet

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios (possibly depending on the table) from which the result can be calculated.

get_winning_numbers(table: Table) list[int]
get_losing_numbers(table: Table) list[int]
get_payout_ratio(table: Table) float
update_number(table: Table)
is_allowed(player: Player) bool

Checks whether the bet is allowed to be placed on the given table. May depend on the player’s bets also (e.g. for odds bets).

Parameters:

player

Returns:

True if the bet is allowed, otherwise false.

Return type:

bool

property _placed_key: Hashable
__repr__() str
class crapssim.bet.Odds(base_type: Type[PassLine | DontPass | Come | DontCome], number: int, amount: float)

Bases: _WinningLosingNumbersBet

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios (possibly depending on the table) from which the result can be calculated.

base_type
number
property light_side: bool
property dark_side: bool
get_winning_numbers(table: Table) list[int]
get_losing_numbers(table: Table) list[int]
get_payout_ratio(table: Table) float
is_allowed(player: Player) bool

Checks whether the bet is allowed to be placed on the given table. May depend on the player’s bets also (e.g. for odds bets).

Parameters:

player

Returns:

True if the bet is allowed, otherwise false.

Return type:

bool

get_max_odds(table: Table) float
base_amount(player: Player)
property _placed_key: Hashable
__repr__()
class crapssim.bet.Place(number: int, amount: SupportsFloat)

Bases: _SimpleBet

A _SimpleBet has fixed winning and losing numbers and payout ratio that can be known at instantiation and don’t depend on the table.

payout_ratios
losing_numbers: list[int] = [7]
number
payout_ratio
winning_numbers
property _placed_key: Hashable
__repr__() str
class crapssim.bet.Field(amount: SupportsFloat)

Bases: _WinningLosingNumbersBet

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios (possibly depending on the table) from which the result can be calculated.

winning_numbers = [2, 3, 4, 9, 10, 11, 12]
losing_numbers = [5, 6, 7, 8]
get_winning_numbers(table: Table) list[int]
get_losing_numbers(table: Table) list[int]
get_payout_ratio(table: Table) float
class crapssim.bet.CAndE(amount: SupportsFloat)

Bases: _WinningLosingNumbersBet

A _WinningLosingNumbersBet has winning numbers, losing numbers, and payout ratios (possibly depending on the table) from which the result can be calculated.

winning_numbers: list[int] = [2, 3, 11, 12]
losing_numbers: list[int]
get_winning_numbers(table: Table) list[int]
get_losing_numbers(table: Table) list[int]
get_payout_ratio(table: Table) float
class crapssim.bet.Any7(amount: SupportsFloat)

Bases: _SimpleBet

A _SimpleBet has fixed winning and losing numbers and payout ratio that can be known at instantiation and don’t depend on the table.

winning_numbers: list[int] = [7]
losing_numbers: list[int]
payout_ratio: int = 4
class crapssim.bet.Two(amount: SupportsFloat)

Bases: _SimpleBet

A _SimpleBet has fixed winning and losing numbers and payout ratio that can be known at instantiation and don’t depend on the table.

winning_numbers: list[int] = [2]
losing_numbers: list[int]
payout_ratio: int = 30
class crapssim.bet.Three(amount: SupportsFloat)

Bases: _SimpleBet

A _SimpleBet has fixed winning and losing numbers and payout ratio that can be known at instantiation and don’t depend on the table.

winning_numbers: list[int] = [3]
losing_numbers: list[int]
payout_ratio: int = 15
class crapssim.bet.Yo(amount: SupportsFloat)

Bases: _SimpleBet

A _SimpleBet has fixed winning and losing numbers and payout ratio that can be known at instantiation and don’t depend on the table.

winning_numbers: list[int] = [11]
losing_numbers: list[int]
payout_ratio: int = 15
class crapssim.bet.Boxcars(amount: SupportsFloat)

Bases: _SimpleBet

A _SimpleBet has fixed winning and losing numbers and payout ratio that can be known at instantiation and don’t depend on the table.

winning_numbers: list[int] = [12]
losing_numbers: list[int]
payout_ratio: int = 30
class crapssim.bet.AnyCraps(amount: SupportsFloat)

Bases: _SimpleBet

A _SimpleBet has fixed winning and losing numbers and payout ratio that can be known at instantiation and don’t depend on the table.

winning_numbers: list[int] = [2, 3, 12]
losing_numbers: list[int]
payout_ratio: int = 7
class crapssim.bet.HardWay(number: int, amount: SupportsFloat)

Bases: Bet

A generic bet for the craps table

Parameters:

amount (SupportsFloat) – Wagered amount for the bet

amount

Wagered amount for the bet

Type:

float

payout_ratios
number
payout_ratio
get_result(table: Table) BetResult
property winning_result: list[int]
property _placed_key: Hashable
__repr__() str
class crapssim.bet.Fire(amount: float)

Bases: Bet

A generic bet for the craps table

Parameters:

amount (SupportsFloat) – Wagered amount for the bet

amount

Wagered amount for the bet

Type:

float

points_made: set[int]
ended: bool = False
get_result(table: Table) BetResult
is_removable(table: Table) bool
is_allowed(player: Player) bool

Checks whether the bet is allowed to be placed on the given table. May depend on the player’s bets also (e.g. for odds bets).

Parameters:

player

Returns:

True if the bet is allowed, otherwise false.

Return type:

bool

class crapssim.bet._ATSBet(amount: float)

Bases: Bet

Class representing ATS (All, Tall, Small) bets, not a usable bet by itself.

numbers: list[int] = []
type: str = '_ATSBet'
rolled_numbers: set[int]
get_result(table: Table) BetResult
is_removable(table: Table) bool
is_allowed(player: Player) bool

Checks whether the bet is allowed to be placed on the given table. May depend on the player’s bets also (e.g. for odds bets).

Parameters:

player

Returns:

True if the bet is allowed, otherwise false.

Return type:

bool

class crapssim.bet.All(amount: float)

Bases: _ATSBet

Class representing ATS (All, Tall, Small) bets, not a usable bet by itself.

type: str = 'all'
numbers: list[int] = [2, 3, 4, 5, 6, 8, 9, 10, 11, 12]
class crapssim.bet.Tall(amount: float)

Bases: _ATSBet

Class representing ATS (All, Tall, Small) bets, not a usable bet by itself.

type: str = 'tall'
numbers: list[int] = [8, 9, 10, 11, 12]
class crapssim.bet.Small(amount: float)

Bases: _ATSBet

Class representing ATS (All, Tall, Small) bets, not a usable bet by itself.

type: str = 'small'
numbers: list[int] = [2, 3, 4, 5, 6]