How uoftcprg/pokerkit works
Main Components
• Core Library (pokerkit directory): This is the heart of the project. The primary modules include:
– games.py: Defines poker game variants and game-specific logic.
– state.py: Manages the state of a game (e.g., dealing, betting, board management).
– analysis.py: Contains functions for simulating game strategies and statistical evaluation.
– hands.py, lookups.py, and notation.py: Offer utilities and adjunct functionality such as hand evaluation, card lookups, and game notation parsing.
– utilities.py: Provides helper functions to support various operations.
• Testing Suite (pokerkit/tests): Contains unit tests and doctests ensuring 99% code coverage, thus validating the reliability of the implementations.
• Configuration and CI: The .github folder (with workflows) and other configuration files like setup.py, requirements.txt, and .readthedocs.yml are used for building, testing, and deployment.
Out Interactions
• API Layer: The public-facing API (as seen in examples within the README) exposes factory methods such as create_state() for different game types. Show how client code calls these API functions.
– games.py uses state.py to create and maintain game state.
– state.py relies on utilities, lookups, and even analysis functions.
– notation.py is a helper to parse string representations of hands or moves.
• Testing and Validation: Illustrate a separate block for unit tests that interact with nearly every core module.
• Documentation can be shown as an auxiliary component that supports maintenance and user/developer onboarding.
Architectural Patterns and Design Principles
• Modular Design: Each poker variant is encapsulated in its own module or set of functions. This separation of concerns is a key feature.
• Flexibility and Extensibility: The design supports user-defined games and custom parameters.
• Programmatic API: The unified API layer abstracts away the underlying complex interactions among state management, game logic, and utility functions.
Step-by-Step Process for the Principal Software Engineer
• Create nodes for the public API (the user interface exposed by the library) and then branch out to core functional modules such as the game definitions (games.py), state management (state.py), and helper utilities (hands.py, lookups.py, notation.py).
• A separate set of nodes for testing (from pokerkit/tests) and note their coverage of each core module.
• Outside the “core” area, include blocks for documentation as well as configuration and CI/CD artifacts to present a holistic picture.