https://github.com/marcusbuffett/command-line-chess
A python program to play chess against an AI in the terminal.
https://github.com/marcusbuffett/command-line-chess
chess hacktoberfest python
Last synced: 23 days ago
JSON representation
A python program to play chess against an AI in the terminal.
- Host: GitHub
- URL: https://github.com/marcusbuffett/command-line-chess
- Owner: marcusbuffett
- License: mit
- Created: 2014-10-28T14:51:57.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-05-29T21:21:28.000Z (about 1 year ago)
- Last Synced: 2025-05-09T03:01:44.540Z (about 1 month ago)
- Topics: chess, hacktoberfest, python
- Language: Python
- Homepage:
- Size: 216 KB
- Stars: 511
- Watchers: 23
- Forks: 168
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: FUNDING.yml
- License: LICENSE
- Code of conduct: CODE-OF-CONDUCT.md
Awesome Lists containing this project
README
[](https://repl.it/github/marcusbuffett/command-line-chess)
# command-line-chess
[](https://choosealicense.com/licenses/mit/)
[](https://GitHub.com/marcusbuffett/command-line-chess/graphs/commit-activity)
[](https://www.python.org/)
[](http://makeapullrequest.com)
[](https://pypi.python.org/project/cl-chess/)
[](https://pypi.org/project/cl-chess)
[](https://GitHub.com/marcusbuffett/command-line-chess/issues/)
[](https://github.com/marcusbuffett/command-line-chess)
[](https://github.com/marcusbuffett/command-line-chess)A python program to play chess against an AI in the terminal.
Also check out my other project, a [chess training site](https://chessmadra.com/).
## Features
- Play chess against an AI in the terminal
- Two player mode (run `chess --two` to enter)
- possible commands:
* `a3`, `Nc3`, `Qxa`, etc: make a move
* `l`: prints every legal move
* `r`: make a random move
* `u`: undo your last move
* `quit`: resign the current game
* `gm`: prints moves of current game in PGN format
* `?`: help, prints all available commands## Screenshots
Initial State:
First move:

## Installation
### Install from [PyPI](https://pypi.org/project/cl-chess/)
Just run the following command:```
pip install cl-chess
```### Install from source
- First clone the repository:
```
git clone https://github.com/marcusbuffett/command-line-chess
```
- navigate into the newly created `command-line-chess` directory and run:
```
pip install .
```
## Usage```sh
chess -h # to see all possible options
```
```
usage: chess [-h] [-t] [-w W] [-b B] [-c]A python program to play chess against an AI in the terminal.
optional arguments:
-h, --help show this help message and exit
-t, --two to play a 2-player game (default: False)
-w W, --white W color for white player (default: white)
-b B, --black B color for black player (default: black)
-c, --checkered use checkered theme for the chess board (default: False)Enjoy the game!
```
## Contributing
Contributions are always welcome!
See `CONTRIBUTING.md`for ways to get started.
Please adhere to this project's `CODE-OF-CONDUCT.md`.
## LICENSE
Take a look at the [LICENSE](https://github.com/marcusbuffett/command-line-chess/LICENSE) file## Authors
- [@marcusbuffett](https://www.github.com/marcusbuffett)
- [@ClasherKasten](https://www.github.com/ClasherKasten)## Questions, bugs, etc.
Please create an issue.## Technical stuff
The AI is a simple brute-force AI with no pruning. It evaluates a given position by counting the value of the pieces for each side (pawn -> 1, knight/bishop -> 3, rook -> 5, queen -> 9). It will evaluate the tree of moves, and take the path that results in the greatest gain. To learn more, check out [my post on how it works](https://mbuffett.com/posts/chess-ai/).