tictactoe-vish


Nametictactoe-vish JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA modern, well-tested Tic-Tac-Toe game implementation in Python with CLI interface and AI opponent
upload_time2025-07-24 17:44:03
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords game tic-tac-toe ai minimax cli
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Tic-Tac-Toe Game

[![CI](https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe/workflows/CI/badge.svg)](https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe/actions)
[![Coverage](https://codecov.io/gh/v-s-v-i-s-h-w-a-s/tic-tac-toe/branch/main/graph/badge.svg)](https://codecov.io/gh/v-s-v-i-s-h-w-a-s/tic-tac-toe)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

A well-tested Tic-Tac-Toe game implementation in Python with a CLI interface and AI opponent.

---

## Features

* Interactive command-line interface
* AI opponent with multiple difficulty levels
* Human vs Human gameplay
* Smart AI using minimax algorithm
* Comprehensive test suite with >95% coverage
* Modern Python development setup with pre-commit hooks
* Proper package structure and configuration

---

## Installation

### From PyPI

```bash
pip install tictactoe-vish
```

### Development Installation

```bash
git clone https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe.git
cd tic-tac-toe
pip install -e .[dev]
```

---

## Usage

### Command Line Interface

```bash
# Run the game
tictactoe

# Or if installed in development mode
python -m src.tictactoe.cli
```

### As a Library

```python
from tictactoe import Board, AIPlayer

# Create a game
board = Board()
ai = AIPlayer(difficulty="hard")

# Make moves
board.make_move(1, 1)  # Human move to center
ai_move = ai.get_best_move(board)  # AI calculates best move
board.make_move(ai_move[0], ai_move[1])  # AI makes move

# Check game state
if board.check_winner():
    print(f"Winner: {board.check_winner()}")
elif board.is_full():
    print("It's a tie!")
```

---

## Game Rules

* Players take turns placing X's and O's on a 3x3 grid
* First player to get 3 in a row (horizontally, vertically, or diagonally) wins
* If the grid fills up with no winner, it's a tie
* Positions are specified as row,col coordinates (0-2 for each)

---

## AI Difficulty Levels

* **Easy**: Random moves
* **Medium**: Blocks opponent wins and takes available wins
* **Hard**: Uses minimax algorithm for optimal play

---

## Development

### Setup Development Environment

```bash
# Clone and install
git clone https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe.git
cd tic-tac-toe
pip install -e .[dev]

# Install pre-commit hooks
pre-commit install
```

### Running Tests

```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=src/tictactoe --cov-report=html

# Run specific test file
pytest tests/test_board.py
```

### Code Quality

```bash
# Format code
black src tests

# Sort imports
isort src tests

# Lint code
flake8 src tests
pylint src

# Run all pre-commit hooks
pre-commit run --all-files
```

---

## Project Structure

```
tic-tac-toe/
├── .github/workflows/        # CI/CD pipelines
├── src/tictactoe/            # Main package
│   ├── __init__.py           # Package initialization
│   ├── board.py              # Game logic
│   ├── cli.py                # Command-line interface
│   └── ai.py                 # AI implementation
├── tests/                    # Test suite
├── pyproject.toml            # Project configuration
├── .pre-commit-config.yaml   # Code quality hooks
└── README.md                 # This file
```

---

## Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b amazing-feature`)
3. Make your changes
4. Run the test suite (`pytest`)
5. Commit your changes (`git commit -m 'Add amazing feature'`)
6. Push to the branch (`git push origin amazing-feature`)
7. Open a Pull Request

### Development Guidelines

* Write tests for new features
* Maintain code coverage above 95%
* Follow PEP 8 style guidelines (enforced by black and flake8)
* Add type hints to new functions
* Update documentation as needed

---

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

## Acknowledgments

* Classic Tic-Tac-Toe game rules
* Minimax algorithm for AI implementation
* Python community for excellent tooling

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tictactoe-vish",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Vishwas <your.email@example.com>",
    "keywords": "game, tic-tac-toe, ai, minimax, cli",
    "author": null,
    "author_email": "Vishwas <your.email@example.com>",
    "download_url": "https://files.pythonhosted.org/packages/4a/70/9a9b22e37978cde572830c8e5edd307113ab5f414e6786984427a77e1daa/tictactoe_vish-0.1.0.tar.gz",
    "platform": null,
    "description": "# Tic-Tac-Toe Game\n\n[![CI](https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe/workflows/CI/badge.svg)](https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe/actions)\n[![Coverage](https://codecov.io/gh/v-s-v-i-s-h-w-a-s/tic-tac-toe/branch/main/graph/badge.svg)](https://codecov.io/gh/v-s-v-i-s-h-w-a-s/tic-tac-toe)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nA well-tested Tic-Tac-Toe game implementation in Python with a CLI interface and AI opponent.\n\n---\n\n## Features\n\n* Interactive command-line interface\n* AI opponent with multiple difficulty levels\n* Human vs Human gameplay\n* Smart AI using minimax algorithm\n* Comprehensive test suite with >95% coverage\n* Modern Python development setup with pre-commit hooks\n* Proper package structure and configuration\n\n---\n\n## Installation\n\n### From PyPI\n\n```bash\npip install tictactoe-vish\n```\n\n### Development Installation\n\n```bash\ngit clone https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe.git\ncd tic-tac-toe\npip install -e .[dev]\n```\n\n---\n\n## Usage\n\n### Command Line Interface\n\n```bash\n# Run the game\ntictactoe\n\n# Or if installed in development mode\npython -m src.tictactoe.cli\n```\n\n### As a Library\n\n```python\nfrom tictactoe import Board, AIPlayer\n\n# Create a game\nboard = Board()\nai = AIPlayer(difficulty=\"hard\")\n\n# Make moves\nboard.make_move(1, 1)  # Human move to center\nai_move = ai.get_best_move(board)  # AI calculates best move\nboard.make_move(ai_move[0], ai_move[1])  # AI makes move\n\n# Check game state\nif board.check_winner():\n    print(f\"Winner: {board.check_winner()}\")\nelif board.is_full():\n    print(\"It's a tie!\")\n```\n\n---\n\n## Game Rules\n\n* Players take turns placing X's and O's on a 3x3 grid\n* First player to get 3 in a row (horizontally, vertically, or diagonally) wins\n* If the grid fills up with no winner, it's a tie\n* Positions are specified as row,col coordinates (0-2 for each)\n\n---\n\n## AI Difficulty Levels\n\n* **Easy**: Random moves\n* **Medium**: Blocks opponent wins and takes available wins\n* **Hard**: Uses minimax algorithm for optimal play\n\n---\n\n## Development\n\n### Setup Development Environment\n\n```bash\n# Clone and install\ngit clone https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe.git\ncd tic-tac-toe\npip install -e .[dev]\n\n# Install pre-commit hooks\npre-commit install\n```\n\n### Running Tests\n\n```bash\n# Run all tests\npytest\n\n# Run with coverage\npytest --cov=src/tictactoe --cov-report=html\n\n# Run specific test file\npytest tests/test_board.py\n```\n\n### Code Quality\n\n```bash\n# Format code\nblack src tests\n\n# Sort imports\nisort src tests\n\n# Lint code\nflake8 src tests\npylint src\n\n# Run all pre-commit hooks\npre-commit run --all-files\n```\n\n---\n\n## Project Structure\n\n```\ntic-tac-toe/\n\u251c\u2500\u2500 .github/workflows/        # CI/CD pipelines\n\u251c\u2500\u2500 src/tictactoe/            # Main package\n\u2502   \u251c\u2500\u2500 __init__.py           # Package initialization\n\u2502   \u251c\u2500\u2500 board.py              # Game logic\n\u2502   \u251c\u2500\u2500 cli.py                # Command-line interface\n\u2502   \u2514\u2500\u2500 ai.py                 # AI implementation\n\u251c\u2500\u2500 tests/                    # Test suite\n\u251c\u2500\u2500 pyproject.toml            # Project configuration\n\u251c\u2500\u2500 .pre-commit-config.yaml   # Code quality hooks\n\u2514\u2500\u2500 README.md                 # This file\n```\n\n---\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b amazing-feature`)\n3. Make your changes\n4. Run the test suite (`pytest`)\n5. Commit your changes (`git commit -m 'Add amazing feature'`)\n6. Push to the branch (`git push origin amazing-feature`)\n7. Open a Pull Request\n\n### Development Guidelines\n\n* Write tests for new features\n* Maintain code coverage above 95%\n* Follow PEP 8 style guidelines (enforced by black and flake8)\n* Add type hints to new functions\n* Update documentation as needed\n\n---\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## Acknowledgments\n\n* Classic Tic-Tac-Toe game rules\n* Minimax algorithm for AI implementation\n* Python community for excellent tooling\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A modern, well-tested Tic-Tac-Toe game implementation in Python with CLI interface and AI opponent",
    "version": "0.1.0",
    "project_urls": {
        "Changelog": "https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe/releases",
        "Homepage": "https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe",
        "Issues": "https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe/issues",
        "Repository": "https://github.com/v-s-v-i-s-h-w-a-s/tic-tac-toe"
    },
    "split_keywords": [
        "game",
        " tic-tac-toe",
        " ai",
        " minimax",
        " cli"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "42a1b46b52d73ebf01b423dd88a5d85f286e3879279672ecd3edc3984afbf908",
                "md5": "1c4d996da0cdbb523c6c369e95b1912f",
                "sha256": "22aeb8be818cb8b3428972057e0e087362139bddae68a1108544ddca3a7bea9f"
            },
            "downloads": -1,
            "filename": "tictactoe_vish-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1c4d996da0cdbb523c6c369e95b1912f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9322,
            "upload_time": "2025-07-24T17:44:02",
            "upload_time_iso_8601": "2025-07-24T17:44:02.560604Z",
            "url": "https://files.pythonhosted.org/packages/42/a1/b46b52d73ebf01b423dd88a5d85f286e3879279672ecd3edc3984afbf908/tictactoe_vish-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4a709a9b22e37978cde572830c8e5edd307113ab5f414e6786984427a77e1daa",
                "md5": "ba2088f776f8cadfa3395a3cbce2bf40",
                "sha256": "e46e53a55a21b87bada19d112ac30b403c45674db4aaa716158d3f66a50d49ba"
            },
            "downloads": -1,
            "filename": "tictactoe_vish-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ba2088f776f8cadfa3395a3cbce2bf40",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 15744,
            "upload_time": "2025-07-24T17:44:03",
            "upload_time_iso_8601": "2025-07-24T17:44:03.911735Z",
            "url": "https://files.pythonhosted.org/packages/4a/70/9a9b22e37978cde572830c8e5edd307113ab5f414e6786984427a77e1daa/tictactoe_vish-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-24 17:44:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "v-s-v-i-s-h-w-a-s",
    "github_project": "tic-tac-toe",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "tictactoe-vish"
}
        
Elapsed time: 1.16686s