{"id":17550990,"url":"https://github.com/brianlusina/tictac-ai","last_synced_at":"2025-07-20T21:34:10.977Z","repository":{"id":65916080,"uuid":"601444764","full_name":"BrianLusina/tictac-ai","owner":"BrianLusina","description":"Simple TicTacToe in Python using multiple clients(front ends) with a re-useable game engine with different sets of players(human, randomized computer player and an unbeatable AI using a simple minimax algorithm)","archived":false,"fork":false,"pushed_at":"2025-06-17T07:12:12.000Z","size":849,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-25T13:53:15.084Z","etag":null,"topics":["game","hacktoberfest","minimax","minimax-algorithm","python","python3","tic-tac-toe"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/tictacai/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BrianLusina.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-02-14T04:26:34.000Z","updated_at":"2025-06-17T07:12:09.000Z","dependencies_parsed_at":"2023-10-03T15:45:17.722Z","dependency_job_id":"3a8822c0-c7e8-422d-99a4-1028b3318a03","html_url":"https://github.com/BrianLusina/tictac-ai","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/BrianLusina/tictac-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianLusina%2Ftictac-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianLusina%2Ftictac-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianLusina%2Ftictac-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianLusina%2Ftictac-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BrianLusina","download_url":"https://codeload.github.com/BrianLusina/tictac-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianLusina%2Ftictac-ai/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264757141,"owners_count":23659313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game","hacktoberfest","minimax","minimax-algorithm","python","python3","tic-tac-toe"],"created_at":"2024-10-21T04:44:33.322Z","updated_at":"2025-07-11T07:36:18.605Z","avatar_url":"https://github.com/BrianLusina.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TicTacToe AI\n\nA Rudimentary AI based tic tac toe game in Python consisting of 2 elements:\n\n1. Game Engine library\n2. Game Clients(front ends)\n\n## Getting started\n\nEnsure you have the following first before you proceed:\n\n1. [Python 3.10+](https://www.python.org/)\n\n    You will require Python 3.1o+ to run this project. If you are using a different version of Python, you will need to\n    update your Python version to 3.5+ to run this project. You can check your Python version by running python --version in\n    your terminal. There are ways to install different versions of Python on your system and this can be done\n    using [pyenv](https://github.com/pyenv/pyenv)\n\n2. [Poetry](https://python-poetry.org/)\n\n   Poetry is a Python package manager that is used to manage dependencies. You can check the installation instructions\n   in the link provided to get this setup.\n\nThe [game engine library](./tictacai/) has some dependencies it needs first. You can install using `poetry`:\n\n``` shell\npoetry install\n```\n\n## Game Engine Library\n\nThe underlying game logic is encapsulated in a common library, which can be reused across\nmultiple [game front ends](#game-front-ends) without duplicating\nthe code.\n\n### Installing\n\nBefore proceeding make sure you have created a virtual environment, activated it and installed the tictacai game engine\nlibrary into it.\nThis can be done using [poetry](https://python-poetry.org/), however, the setup for\nthe [virtual environment](https://docs.python.org/3/library/venv.html) can be done using Python(Recommendation is to use\nPython 3.10 and upwards).\n\n``` shell\ncd tictac-ai\npython -m venv .venv/\nsource .venv/bin/activate\n(venv) python -m pip install tictacai/\n```\n\n\u003e This will let you test the game front ends provided by this project\n\n### Packaging\n\nOne of the available front ends relies on the library distributed as a Python [wheel](https://pypi.org/project/wheel/).\nTherefore, you must build and package the library accordingly:\n\n```shell\ncd tictac-ai\npython -m pip wheel tictacai\nmv tictacai-0.1.0-py3-none-any.whl clients/browser\n```\n\n\u003e Note that you don't need a virtual environment for these commands to work, but running them in one is completely fine.\n\n## Game Front Ends\n\nThere are a few game front ends implemented in separate packages. Before running them, make sure you have followed the\nearlier steps. Now, change directory to the game clients parent folder:\n\n```shell\ncd tictac-ai/clients/\n```\n\n### Browser Front End\n\nPlay tic tac toe in your web proser through PyScript:\n\n```shell\npython -m browser\n```\n\nThis will start a local HTTP server and open the hosted HTML file in the browser. Not that you don't need to create a\nvirtual environment or install the game engine library to play the game because it's loaded dynamically from a Python\nwheel file.\n\n### Console Front End\n\nPlay tic tac toe in the terminal:\n\n``` shell\n(venv) python -m console\n```\n\nYou can optionally set one or both players to a human player(`human`), a computer player making random moves(`random`)\nor an\nunbeatable minimax computer player(`minimax`), as well as change the starting player:\n\n``` shell\n(venv) python -m console -X minimax -O random --starting O\n```\n\nSample game play:\n\n![console](./docs/console.gif)\n\n### Window Front End\n\nPlay tic tac toe against a minimax computer player in a GUI application built with Tkinter:\n\n```shell\n(venv) $ python -m window\n```\n\nTo change the players, who are currently hard coded, you'll need to edit the following fragment of the client code:\n\n```python\ndef game_loop(window: Window, events: Queue) -\u003e None:\n    player1 = WindowPlayer(Mark(\"X\"), events)\n    player2 = MinimaxComputerPlayer(Mark(\"O\"))\n    starting_mark = Mark(\"X\")\n    TicTacToe(player1, player2, WindowRenderer(window)).play(starting_mark)\n```\n\n\u003e This can be found in the file [cli.py](./clients/window/cli.py)\n\nSample game play:\n\n![window](./docs/window.gif)\n\n## Built With\n\n 1. [Python 3.10](https://www.python.org/)\n 2. [Poetry](https://python-poetry.org/)\n\n## Contributing\n\nPlease read the [contributing guide](./.github/CONTRIBUTING.md) to learn how to contribute to this project.\n\n## Versioning\n\n[Semantic versioning](https://semver/) is used to track the version of the project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianlusina%2Ftictac-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrianlusina%2Ftictac-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianlusina%2Ftictac-ai/lists"}