{"id":26273325,"url":"https://github.com/zai-kun/chust","last_synced_at":"2025-07-31T02:03:16.500Z","repository":{"id":281640230,"uuid":"936617989","full_name":"Zai-Kun/chust","owner":"Zai-Kun","description":"A chess bot that plays chess for you automatically without much initial setup that uses machine learning for detecting chessboard and pieces.","archived":false,"fork":false,"pushed_at":"2025-03-23T17:24:55.000Z","size":1466,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T23:24:39.265Z","etag":null,"topics":["ai","bot","chess","chess-ai","chess-bot","computer-vision","easy","machine-learning","multi-feature","onnx","onnxruntime","ort","rust","tool","yolo","yolov11"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zai-Kun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-21T11:50:22.000Z","updated_at":"2025-03-23T17:24:58.000Z","dependencies_parsed_at":"2025-03-10T11:42:32.640Z","dependency_job_id":null,"html_url":"https://github.com/Zai-Kun/chust","commit_stats":null,"previous_names":["zai-kun/chust"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zai-Kun%2Fchust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zai-Kun%2Fchust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zai-Kun%2Fchust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zai-Kun%2Fchust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zai-Kun","download_url":"https://codeload.github.com/Zai-Kun/chust/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252570474,"owners_count":21769659,"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":["ai","bot","chess","chess-ai","chess-bot","computer-vision","easy","machine-learning","multi-feature","onnx","onnxruntime","ort","rust","tool","yolo","yolov11"],"created_at":"2025-03-14T08:16:14.101Z","updated_at":"2025-05-05T20:29:03.227Z","avatar_url":"https://github.com/Zai-Kun.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chust\n\n**Chust** is a Rust-based tool that leverages machine learning to detect chessboards and pieces from images. It can extract Forsyth-Edwards Notation (FEN) from a chessboard image, mark detected pieces, and even play a game of chess for you as a bot.\n\n\nhttps://github.com/user-attachments/assets/05ea390d-cef0-47d6-ab40-e832f84fa61c\n\n![screenshot](https://github.com/user-attachments/assets/0cb00ed8-971e-48c8-a6a7-4158c866ccae)\n\n\n## Features\n\n- **Bot Gameplay** - A chess bot; plays chess automatically for you.\n- **Chessboard and Piece Detection** - Extracts the position of chess pieces from an image.\n- **FEN Generation** - Converts detected chessboard positions into FEN notation.\n- **Visual Marking** - Highlights detected pieces for verification.\n- **Refined Search Mode** - Enhances accuracy by performing a secondary detection on a cropped chessboard.\n\n## Installation\n\n### Prebuilt Binaries\nYou can find prebuilt binaries for Windows (thanks to [@SenZmaKi](https://github.com/SenZmaKi)) and Linux on the [Releases](https://github.com/Zai-Kun/chust/releases) page. For macOS and other platforms, you will need to compile Chust manually.\n\n### Compiling from Source\nEnsure you have Rust and Cargo installed. On Windows, you also need [Visual Studio 2022 (≥ 17.11)](https://visualstudio.microsoft.com/) installed.\n\n```sh\ngit clone https://github.com/Zai-Kun/chust \u0026\u0026 cd chust\ncargo build --release\n```\n\nThe compiled binary will be available in the `./target/release` folder.\n\n#### Optional: Embedding the Model\nTo embed the machine learning model directly into Chust, use:\n\n```sh\ncargo build --release --features embed_model\n```\n\nMake sure the model is downloaded and placed in the Chust directory before building.\n\n## Usage\n\nChust provides two primary commands:\n- `process` - Analyze an image for chessboard detection and FEN extraction.\n- `play` - Play a game of chess automatically.\n\n### Requirements\n\n#### Machine Learning Model\n*Not needed if compiled with `embed_model`. If using a prebuilt binary, this is required.*\n\nDownload the ONNX model from the [2D Chess Pieces Detection](https://github.com/Zai-Kun/2d-chess-pieces-detection/releases) page. Ensure it is saved as `chess_detection.onnx` in the same directory as Chust or specify its path with `--model-path`.\n\n#### Stockfish Engine (Optional, for `play` command)\nStockfish is required for Chust to play chess as a bot.\n\n- Download from [Stockfish Chess](https://stockfishchess.org/download/).\n- On Arch Linux, install via `yay -S stockfish`.\n\n### Commands \u0026 Examples\n\n#### Play a Game as a Bot\n\n```sh\nchust play\n```\n\n##### Options:\n- `--castle-w` - Enable castling for white.\n- `--castle-b` - Enable castling for black.\n- `--pov` - Choose to play as black (`b`) or white (`w`).\n- `--stockfish-path` - Path to the Stockfish engine executable.\n- `--stockfish-depth` - Depth for Stockfish analysis.\n- `--model-path` - Path to the machine learning model.\n\n##### Platform-Specific Customization:\nIf Chust does not support automatic screen capturing and clicking on your OS, you can specify custom commands:\n\n- `--screenshot-command` - Command that outputs a screenshot to stdout for Chust to process.\n- `--click-command` - Command to simulate a mouse click at coordinates `{x}` and `{y}`.\n\nFor more details:\n```sh\nchust play --help\n```\n\n#### Example: Play Blitz\n```sh\nchust play --pov w --screenshot-delay=0.3 --stockfish-depth=10\n```\n\n#### Example: Normal Game with Animation Lag\n```sh\nchust play --pov w --screenshot-delay=0.4 --stockfish-depth=20 --recheck-after-change\n```\n\n#### Example: Enable Castling\n```sh\nchust play --castle-w --castle-b\n```\n\n# Known Issues\n\n* **Promotion is not automatic**: If a pawn reaches the last rank, you will need to manually promote it.\n* **False move detection**: Sometimes Chust may think that the opponent has moved when they actually haven't. If this happpens to you, you may need to adjust `--screenshot-delay` and you may need to add `--recheck-after-change`.\n* **Model failure**: The model isn't perfect and it may fail in some cases but that rarely happens.\n\n## License\nThis project is licensed under the MIT License.\n\n## Contributing\nContributions are welcome! Feel free to open issues and submit pull requests.\n\n---\n\n*Made with ❤️ in Rust by Zai.*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzai-kun%2Fchust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzai-kun%2Fchust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzai-kun%2Fchust/lists"}