Skip to content

Add equity and probability calculation features #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2025

Conversation

JohnDaWalka
Copy link
Owner

@JohnDaWalka JohnDaWalka commented Mar 27, 2025


For more details, open the Copilot Workspace session.

Summary by Sourcery

Add equity and probability calculation features for poker decision-making

New Features:

  • Implement poker hand equity calculation using pokerstove library
  • Create functions to calculate pot odds
  • Develop a SQLAlchemy-based database to store RFI (Raise First In) poker hand data

Enhancements:

  • Add database storage for tracking poker hand equity and probabilities
  • Provide methods for analyzing poker hand decision-making

Build:

  • Add pokerstove library to requirements

Documentation:

  • Update README with documentation on equity and probability calculation process
  • Add instructions for syncing RFI database with business intelligence tools

Copy link

sourcery-ai bot commented Mar 27, 2025

Reviewer's Guide by Sourcery

This pull request introduces equity and probability calculation features for poker hand analysis. It includes functions to calculate equity and pot odds, a database to store the calculated values, and instructions on how to use these features. The pokerstove library is used for equity calculations, and SQLAlchemy is used for database interactions. Instructions for syncing the database with Microsoft BI or Graph SQL have also been added to the README.

Sequence diagram for storing equity and probabilities

sequenceDiagram
    participant User
    participant howdoi.py
    participant RFIData
    participant Database

    User->>howdoi.py: Calls store_equity_and_probabilities(hand, range_of_hands, equity, pot_odds)
    howdoi.py->>RFIData: Creates RFIData object with hand, range_of_hands, equity, pot_odds
    howdoi.py->>Database: Opens connection to rfi_database.db
    Database->>Database: Creates rfi_data table if not exists
    howdoi.py->>Database: Adds RFIData object to session
    howdoi.py->>Database: Commits session
    Database->>Database: Saves data to rfi_data table
    howdoi.py->>Database: Closes connection
    Database-->>howdoi.py: Returns success
    howdoi.py-->>User: Returns success
Loading

Updated class diagram for RFIData

classDiagram
    class RFIData {
        - id: Integer
        - hand: String
        - range_of_hands: String
        - equity: Float
        - pot_odds: Float
    }
    note for RFIData "Represents data for Raise First In (RFI) decisions, including hand, range of hands, equity, and pot odds."
Loading

File-Level Changes

Change Details Files
Implemented equity and pot odds calculation functions using the pokerstove library.
  • Added calculate_equity function to calculate hand equity against a range of hands.
  • Added calculate_pot_odds function to calculate pot odds based on the current pot size and cost of call.
howdoi/howdoi.py
Added database functionality to store equity and pot odds data using SQLAlchemy.
  • Imported necessary SQLAlchemy modules.
  • Defined a RFIData model to represent the database table schema.
  • Implemented store_equity_and_probabilities function to store calculated equity and pot odds in a SQLite database.
  • Created a SQLite database file named rfi_database.db.
howdoi/howdoi.py
Added instructions on how to use the new equity and probability calculation features to the README.
  • Added a new section 'Equity and Probability Calculation' to explain how to calculate equity and pot odds for RFI decisions.
  • Added a new section 'Syncing RFI Database with Microsoft BI or Graph SQL' to explain how to sync the RFI database with external tools.
README.md
Added pokerstove as a project dependency.
  • Added pokerstove to the requirements.txt file.
requirements.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @JohnDaWalka - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a command-line interface to expose the new functionality.
  • The database connection string is hardcoded; consider making it configurable.
Here's what I looked at during the review
  • 🟡 General issues: 6 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@JohnDaWalka JohnDaWalka merged commit 6f765d4 into master Mar 27, 2025
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant