Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
dabee2b
AllBets: remove unused Currency TypeAlias per review (no behavior cha…
nova-rey Oct 29, 2025
fddeaf2
Merge pull request #58 from nova-rey/codex/remove-unused-currency-typ…
nova-rey Oct 29, 2025
e4d048f
Simplify commission handling
nova-rey Oct 29, 2025
241db36
Merge pull request #59 from nova-rey/codex/simplify-commission-logic-…
nova-rey Oct 29, 2025
936a77a
fix: align Horn/World payout ratios with 'to 1' convention; add combi…
nova-rey Oct 29, 2025
7a98763
Merge pull request #60 from nova-rey/codex/implement-horn/world-payou…
nova-rey Oct 29, 2025
6093c26
Remove redundant overrides from bet subclasses
nova-rey Oct 29, 2025
9ed73c7
Merge pull request #61 from nova-rey/codex/remove-redundant-overrides…
nova-rey Oct 29, 2025
cd0dcf3
Remove redundant Put bet guard
nova-rey Oct 29, 2025
dd5d8c4
Merge pull request #62 from nova-rey/codex/remove-redundant-put-bet-g…
nova-rey Oct 29, 2025
d0decc9
Remove allow_put_odds table setting
nova-rey Oct 29, 2025
56c219a
Merge pull request #63 from nova-rey/codex/remove-allow_put_odds-setting
nova-rey Oct 29, 2025
a88f530
Bake fixed 5% commission: remove configurable setting, refactor helpe…
nova-rey Oct 29, 2025
d600a09
Merge pull request #64 from nova-rey/codex/bake-fixed-5%-commission-i…
nova-rey Oct 29, 2025
d408e8d
Simplify examples: remove HornShowcase; split into HornExample and Wo…
nova-rey Oct 29, 2025
9acc921
Merge pull request #65 from nova-rey/codex/remove-hornshowcase-and-ad…
nova-rey Oct 29, 2025
6d6108d
chore: ignore generated reports while preserving existing files
nova-rey Oct 29, 2025
c337d16
Merge pull request #66 from nova-rey/codex/add-ignore-for-generated-r…
nova-rey Oct 29, 2025
5ee54ca
Adjust buy/lay commission bookkeeping
nova-rey Nov 3, 2025
a7e52a9
Merge pull request #67 from nova-rey/codex/update-buy/lay-bookkeeping…
nova-rey Nov 3, 2025
89dedfb
fix: use table.fixed_run for full roll execution in example script
nova-rey Nov 3, 2025
22ff171
Merge pull request #70 from nova-rey/codex/replace-tableupdate.roll-w…
nova-rey Nov 3, 2025
8d3e865
chore: correct HornExample amount to 4.0 for proper per-number wager
nova-rey Nov 6, 2025
b7b6858
Merge pull request #71 from nova-rey/codex/update-hornexample-amount-…
nova-rey Nov 6, 2025
567aaaa
Consolidate commission handling and tests
nova-rey Nov 6, 2025
5e1b225
Merge pull request #72 from nova-rey/codex/consolidate-commission-log…
nova-rey Nov 6, 2025
a3dcdf3
Unify commission calculations and update tests
nova-rey Nov 6, 2025
f19982e
Merge pull request #73 from nova-rey/codex/unify-commission-logic-and…
nova-rey Nov 6, 2025
7bcc027
Delete REPORT_verification.md
nova-rey Nov 6, 2025
5302003
Simplify and fix Buy/Lay bets
skent259 Nov 8, 2025
6d214de
Revert the payout ratios for Horn and World bets
skent259 Nov 8, 2025
4c0429a
Remove Put takedown logic
skent259 Nov 8, 2025
805f27c
Clean up docs, tests, and misc files
skent259 Nov 8, 2025
75a63c0
Merge pull request #74 from skent259/pr-updates
nova-rey Nov 8, 2025
183f35b
Merge pull request #73 from nova-rey/main
skent259 Nov 9, 2025
bd03fba
OddsMultiplier strategy supports float odds multiplier
skent259 Nov 6, 2025
a560507
Add WinMultiplier strategy
skent259 Nov 10, 2025
180670c
Add WinMultiplier strategy helpers for individual odds types
skent259 Nov 10, 2025
d14a54d
Add _condense_multiplier_dict helper to further refactor strategy.odd…
skent259 Nov 10, 2025
511dfe3
Rename the base type helpers and clean up the documentation slightly
skent259 Nov 10, 2025
ed52f2a
Merge pull request #74 from skent259/fix-strategy-repr
skent259 Nov 10, 2025
e77bd0b
Move changelog to first level directory
skent259 Nov 10, 2025
6874186
Update changelog based on 0.3.2 and dev changes, new formatting
skent259 Nov 10, 2025
b4b1c03
Update contributing
skent259 Nov 10, 2025
acc7758
Add Supported Bets docs page
skent259 Nov 11, 2025
319dca8
Modify docs file structure
skent259 Nov 11, 2025
db884c9
Update authors and docs/conf.py version
skent259 Nov 11, 2025
1b290c1
Merge pull request #75 from skent259/improve-docs
skent259 Nov 11, 2025
1a92187
Clean up typing hints
skent259 Nov 12, 2025
444d56a
Fix: DontPass and DontCome push on come-out 12
skent259 Nov 12, 2025
787ff22
Merge pull request #76 from skent259/fix-dont-pass-pushing
skent259 Nov 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,15 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Project-specific artifacts
baselines/vxp/
reports/
**/vxp_gauntlet/**/summary.md
**/vxp_gauntlet/**/journal.csv

# VScode
.vscode
# === Generated Reports (do not commit) ===
**/reports/
# End reports ignore

69 changes: 51 additions & 18 deletions docs/CHANGELOG.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
# Changelog

## v0.3.1
All notable changes to this project will be documented in this file.

For an alternative view, connecting these changes to Pull Requests, Issues, and new contributors, see the [GitHub Releases](https://github.com/skent259/crapssim/releases)

The format is moving towards this style for new entries: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

## [Unreleased]

### Added

* New bets: `Horn`, `World` (Whirl), `Big6`/`Big8`, `Buy`, `Lay`, and `Put` (with or without odds)
* Corresponding single bet strategies
* Corresponding odds strategies: `PutOddsAmount`, `PutOddsMultiplier`
* Corresponding examples strategies: `QuickProps`, `BuySampler`, `LaySampler`, `PutWithOdds`, `HornExample`, `WorldExample`
* Vig policy settings to TableSettings
* `WinMultiplier` family of strategies which take a desired win multiple and calculates the correct amount based on the bet amount.
* `WinMultiplier` is the general strategy which takes specific bet type argument
* Convenience strategies for individual bets: `PassLineWinMultiplier`, `ComeWinMultiplier`, `DontPassWinMultiplier`, `DontComeWinMultiplier`, and `PutWinMultiplier`
* Stress tests, expanded examples, tools as part of the Vanilla Expansion Project

### Fixed

* `DontPass` and `DontCome` bets will now "push" on a come-out 12, bringing the bet down and returing the bet amount to the player. `_WinningLosingNumbersBet` gains `get_push_numbers()` method to accomodate.
* `OddsMultiplier `__repr__` logic so that floats, ints, and incomplete dictionaries all work for odds/win multiplier

## [0.3.2] - 2025-10-11

### What's Changed
* Restrict strategy updates during runout by @skent259 in https://github.com/skent259/crapssim/pull/62
* Update Risk12 strategy by @skent259 in https://github.com/skent259/crapssim/pull/63
* Reorder integration tests by @skent259 in https://github.com/skent259/crapssim/pull/64
* Verbose: print roll and shooter counts by @JotaGreen in https://github.com/skent259/crapssim/pull/65
* Fix odds bet having result when the point is off by @skent259 in https://github.com/skent259/crapssim/pull/66
* Fix ATS bets, ATS strategy, and strategies with persistent bet features by @skent259 in https://github.com/skent259/crapssim/pull/71


## [0.3.1] - 2025-02-13

### What's Changed
* **BREAKING**: Rename strategy tools and implement new strategy modes by @skent259 in https://github.com/skent259/crapssim/pull/55
Expand All @@ -14,9 +51,7 @@
* Improve documentation by @skent259 in https://github.com/skent259/crapssim/pull/50


**Full Changelog**: https://github.com/skent259/crapssim/compare/v0.3.0...v0.3.1

## v0.3.0 (2024/12/01)
## [0.3.0] - 2024-12-01

This is a major update with breaking changes throughout the package. The changes ensure we can implement new bets and make the strategies much easier for new and old users alike, building for the future of the package.

Expand All @@ -38,25 +73,23 @@ This is a major update with breaking changes throughout the package. The changes
* Clean up strategy module by @skent259 in https://github.com/skent259/crapssim/pull/44
* Incorporate dev updates for version 0.3.0 by @skent259 in https://github.com/skent259/crapssim/pull/45

### New Contributors

* @amortization made their first contribution in https://github.com/skent259/crapssim/pull/3
## [0.2.0] - 2021-03-07

**Full Changelog**: https://github.com/skent259/crapssim/compare/v0.2.0...v0.3.0
- v0.2.0 improves on the UI of v0.1.0 by clarifying internal vs external functions, improving documentation, and other minor changes.

## v0.2.0 (2021/03/07)
## [0.1.1] - 2021-03-07

v0.2.0 improves on the UI of v0.1.0 by clarifying internal vs external functions, improving documentation, and other minor changes.
- Small changes in addition to v0.1.1

## v0.1.1 (2021/03/07)
## 0.1.0 - 2019-03-09

Small changes in addition to v0.1.1
Initial version

## v0.1.0

Initial version
## vxp-phase-baseline — CrapsSim-Vanilla Expansion Complete
- Added Horn, World (Whirl), Big6, Big8, Buy, Lay, Put bets.
- Added commission framework in Buy/Lay.
- Added single-bet strategy wrappers and examples.
- Integration baseline captured under `baselines/vxp/`.
[unreleased]: https://github.com/skent259/crapssim/compare/v0.3.2...HEAD
[0.3.2]: https://github.com/skent259/crapssim/compare/v0.3.1...v0.3.2
[0.3.1]: https://github.com/skent259/crapssim/compare/v0.3.0...v0.3.1
[0.3.0]: https://github.com/skent259/crapssim/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/skent259/crapssim/compare/v0.1.1...v0.2.0
[0.1.1]: https://github.com/skent259/crapssim/releases/tag/v0.1.1
71 changes: 14 additions & 57 deletions CONTRIBUTING → CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Contributing

## How to contribute to crapssim

The current top priorities for the package are to improve
- Documentation
- Supported strategies (see [strategy](https://github.com/sphinx-doc/sphinx/issues/4961))
- Supported bets (see [bet.py](https://github.com/skent259/crapssim/blob/main/crapssim/bet.py), [#38](https://github.com/skent259/crapssim/issues/38))
- Supported strategies (see [strategy](https://github.com/sphinx-doc/sphinx/issues/4961))
- Reducing bugs and other [issues](https://github.com/skent259/crapssim/issues/)

### Do you want to help the documentation?

Expand All @@ -18,11 +20,6 @@ Craps has so many possible strategies, and it's hard to implement them all. The

If you saw a strategy online or in a book, and have implemented with "crapssim", then it most likely makes a great addition to the package. Please mention in [a new discussion](https://github.com/skent259/crapssim/discussions/new), file [an issue](https://github.com/skent259/crapssim/issues/new), or open [a pull request](https://github.com/skent259/crapssim/pulls) and we can work together to make sure it fits well.

### Do you want to help expand supported bets?

Bets to implement are currently being tracked in [#38](https://github.com/skent259/crapssim/issues/38).

This will require detailed knowledge of the package's `bet` module and also of the craps game. Please build out in a forked branch, file a [new pull request](https://github.com/skent259/crapssim/pulls) with your new bet and we can work through the details to make sure it aligns with other bets and standards.

### Did you find a bug?

Expand All @@ -31,39 +28,20 @@ This will require detailed knowledge of the package's `bet` module and also of t

## Contributing — Documentation and Examples

### 1. Writing Tutorials and Examples

Contributors are encouraged to write short, clear tutorials that demonstrate
basic and intermediate use of the package. Each tutorial should:

- Begin with a minimal reproducible example:

```python
from crapssim.table import Table, TableUpdate
import crapssim.bet as B

# Create a table and a single player
t = Table()
p = t.add_player()
### Conventions

# Place and resolve a few bets
p.add_bet(B.PassLine(10))
p.add_bet(B.Buy(4, 25))
TableUpdate.roll(t, fixed_outcome=(2, 2)) # resolve a 4
```
* This project uses [the Black code style](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html) for formatting, which is easily [installed](https://black.readthedocs.io/en/stable/getting_started.html) or available in most IDEs
* Code structure is moving towards [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html) unless it conflicts with Black formatting
* Documentation is moving towards [Google Style Python Docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) (See also [here](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings))

- End with a short discussion of bankroll effects or table state.
Please double check these conventions if submitting a PR.

Tutorials should emphasize clarity of flow and reasoning about outcomes, not
exhaustive enumeration of every bet.

### 2. Function and Type Hinting
### Function and Type Hinting

All internal functions and classes should include:

- A one-line summary docstring describing purpose and domain.
- Explicit type hints for all parameters and return values.
- Reference to table or player context if applicable.

Example:

Expand All @@ -72,38 +50,18 @@ def payout_ratio(number: int) -> float:
"""Return the true odds payout ratio for a given point number."""
```

When adding new modules, prefer `typing.Annotated` or `typing.Literal` where
constraints are known (e.g., specific point numbers, payout categories).

### 3. Descriptive Internal Documentation

When introducing new rules, toggles, or simulation assumptions:

- Explain why the choice exists, not only how it works.
- Link or cite standard rule variants (e.g., "3-4-5x odds structure",
"commission on win vs. on bet").
- Use consistent, declarative tone — avoid subjective phrasing or casual
language.
As above, please use [Google Style Python Docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) (See also [here](https://google.github.io/styleguide/pyguide.html#38-comments-and-docstrings))

### 4. Testing Philosophy
### Testing Philosophy

Tests are expected to cover both numerical and structural correctness. Each
feature addition should include:

- A unit test verifying direct functional behavior.
- An integration or stress test demonstrating stable interaction with other
bets.
- Deterministic seeds where possible to ensure reproducibility.
modules.

Well-documented test cases are considered part of the public tutorial layer:
future contributors should be able to learn from them.

By maintaining clarity in examples, precision in type hints, and strong linkage
between simulation design and domain reasoning, the project can continue to
serve both as a working simulator and as a reference for formal analysis of
craps dynamics.

## Running Tests and Gauntlet
### Running Tests and Gauntlet

To verify correctness locally:

Expand All @@ -120,4 +78,3 @@ bash -lc 'for i in $(seq 1 25); do python tools/vxp_gauntlet.py; sleep 0.2; done
```

Artifacts will appear under reports/vxp_gauntlet/<timestamp>/ and include JSON, CSV, and Markdown summaries.

104 changes: 0 additions & 104 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,116 +83,12 @@ Some results from this simulator have been posted to http://pages.stat.wisc.edu/
- [All Bets Are Off: Re-learning the Pass Line Bet in Craps](http://pages.stat.wisc.edu/~kent/blog/2019.02.28_Craps_Passline/passline-and-odds.html)


## Supported Bets (high level)

- Line & numbers: Pass Line, Come, **Put**, Place (4/5/6/8/9/10), Odds (PL/Come/**Put**)

**Odds behind Put**

Odds on Put bets follow the same logic as Come odds. This behavior can be
disabled for strict house simulation by setting:

```python
table.settings["allow_put_odds"] = False
```
- Dark side: Don’t Pass, Don’t Come, Odds (DP/DC), **Lay** (4/5/6/8/9/10)
- Field & props: Field, **Horn**, **World (Whirl)**, Any 7, Any Craps, 2/3/11/12, Hardways, Hop
- Side features: Fire, All/Tall/Small (ATS), **Big 6**, **Big 8**

### Buy/Lay commission

Buy and Lay use a commission (vig) rate from the table settings:

```python
# default if unset
table.settings.get("commission", 0.05) # 5%
```

Commission is applied by the bet implementation (current default: applied to the potential win). This can be changed by overriding commission in Table.settings.

**Horn / World modeling:**
These are implemented as *net single-wager equivalents* of equal-split sub-bets (Horn across 2/3/11/12; World adds Any 7 break-even). This keeps payouts explicit and avoids sub-bet bookkeeping.

**Buy/Lay commission policy (optional keys):**
- `commission` (float, default `0.05`)
- `commission_mode` (`"on_win"` default, or `"on_bet"`)
- `commission_rounding` (`"none"` default, `"ceil_dollar"`, `"nearest_dollar"`)
- `commission_floor` (float dollars, default `0.0`)
- `allow_put_odds` (`True` default)

**Rounding semantics**
- `nearest_dollar` uses Python’s standard rounding (`round`) which is banker's rounding.
Ties (e.g., 2.5) round to the nearest even integer.
- `ceil_dollar` always rounds up to the next whole dollar.

| Scenario | Settings | Effect (conceptual) |
|----------------------------------|---------------------------------------------------------------------------|-----------------------------------------------|
| Default explicit mode | `commission=0.05`, `commission_mode="on_win"`, `commission_rounding="none"` | Commission = 5% of gross win |
| On-bet with rounding + floor | `commission=0.05`, `commission_mode="on_bet"`, `commission_rounding="ceil_dollar"`, `commission_floor=25.0` | Fee is 5% of bet, rounded up, waived < $25 |

**Legacy commission base (optional)**
If `commission_mode` is **unset** and `commission_multiplier_legacy=True` (default),
Buy/Lay use internal number-based multipliers to determine the commission base before
applying the rate. Set `commission_multiplier_legacy=False` to disable this behavior
and rely solely on the explicit `commission_mode` base.

**Disabling the legacy commission base**

By default, when `commission_mode` is unset and
`commission_multiplier_legacy=True`, the simulator applies internal
number-based multipliers to approximate standard vig behavior.
To disable this legacy baseline and rely solely on the explicit mode:

```python
table.settings["commission_multiplier_legacy"] = False
table.settings["commission_mode"] = "on_win"
```

### Examples

See `crapssim/strategy/examples.py` for:
- QuickProps (World + Big6/Big8)
- BuySampler (Buy 4/10)
- LaySampler (Lay 5/9)
- PutWithOdds (Put on 6 with odds)
- HornShowcase (Horn + World)

### Running examples
A deterministic demo script is provided:

```bash
python -m examples.run_examples
```

This script exercises the new bets (Horn, World, Big6/Big8, Buy/Lay, Put with odds)
over a fixed roll sequence for reproducible behavior.


## Contributing

If you discover something interesting using this simulator, please let me know so that I can highlight those results here. You can find me at skent259@gmail.com.

Those looking to contribute to this project are welcome to do so. Currently, the top priority is to improve

- Supported bets (see [bet.py](https://github.com/skent259/crapssim/blob/main/crapssim/bet.py))
- Supported strategies (see [strategy](https://github.com/skent259/crapssim/tree/main/crapssim/strategy))
- Documentation




### Developer Documentation
See [`docs/VXP_METHODLOGY.md`](docs/VXP_METHODLOGY.md) for a full record of the Vanilla Expansion Project,
including design choices, validation methods, and audit results.


## Stress tests (optional)

A randomized torture test for new bets lives under `tests/stress/`.

- Quick smoke runs by default with `pytest -q`.
- Heavy stress is opt-in:

```bash
pytest -q -m stress
```
8 changes: 0 additions & 8 deletions baselines/vxp/journal.csv

This file was deleted.

10 changes: 0 additions & 10 deletions baselines/vxp/manifest.json

This file was deleted.

14 changes: 0 additions & 14 deletions baselines/vxp/report.json

This file was deleted.

Loading
Loading