First off, thank you for considering contributing to Micro-State-Space! It's people like you that make academic and research-oriented open source projects thrive.
This project and everyone participating in it is governed by the Micro-State-Space Code of Conduct. By participating, you are expected to uphold this code.
Before creating bug reports, please check existing issues to see if the problem has already been reported. When creating a bug report, please include as many details as possible:
- Use a clear and descriptive title for the issue to identify the problem.
- Describe the exact steps which reproduce the problem in as many details as possible.
- Provide specific examples to demonstrate the steps.
- Describe the behavior you observed after following the steps and point out what exactly is the problem.
- Explain which behavior you expected to see instead and why.
- Include screenshots and animated GIFs showing the bug if possible.
- Specify your environment: OS, Python version, Streamlit version.
Enhancement suggestions are tracked as GitHub issues. When creating an enhancement request, please include:
- Use a clear and descriptive title.
- Provide a step-by-step description of the suggested enhancement.
- Provide specific examples to demonstrate the steps.
- Describe the current behavior and explain which behavior you expected to see instead and why.
- Explain why this enhancement would be useful to most users.
- Fill in the required template.
- Do not include issue numbers in the PR title.
- Include screenshots and animated GIFs in your pull request whenever possible.
- End files with a newline.
- Document new code based on the Docstring guidelines.
- Fork the repository on GitHub.
- Clone the fork to your local machine:
git clone https://github.com/YOUR-USERNAME/Micro-State-Space.git cd Micro-State-Space - Create a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
- Install dependencies:
(If
pip install -r requirements.txt
requirements.txtis missing, run:pip install streamlit matplotlib pandas numpy)
If you want to introduce a new micro-state environment, follow these structural requirements:
- Standalone File: Each game must exist as a standalone Streamlit script (e.g.,
new_game.py). - Game Logic Class: Create a class (e.g.,
NewGame) that handles:- State representation (
get_state,get_state_key) - Action generation (
get_valid_actionsorget_valid_moves) - State transition (
make_action) - Terminal state checking (
check_win) - Heuristic evaluation (
evaluate_position) - crucial for Negamax.
- State representation (
- MCTS Node Class: Implement a standard MCTS node class tailored to your game's action representations.
- Agent Class: The agent must combine MCTS (for policy priors and exploration) and Negamax (for leaf evaluation and tactical lookahead), along with tabular Q-learning components for self-play updates.
- Visualization: Use Matplotlib for rendering the board state. Streamlit UI controls should remain in the sidebar.
When modifying the AI architecture (e.g., HexLineAgent, QuantumAgent):
- Maintain the AlphaZero-inspired structure: MCTS uses PUCT, with leaf nodes evaluated by Negamax.
- Ensure that any new hyperparameters (e.g., exploration constants) are exposed in the Streamlit sidebar.
- Update the
serialize_agentanddeserialize_agentfunctions to account for new state variables to ensure save/load functionality is preserved.
- Follow PEP 8 style guidelines.
- Use type hints (from the
typingmodule) for all function arguments and return types. - Keep files self-contained where possible to align with the repository's design philosophy.
- Provide descriptive comments for heuristic evaluation weights. Explain why a specific board configuration receives a specific bonus or penalty.
Thank you for contributing!