A python program to play chess against an AI in the terminal.
Also check out my other project, a chess training site.
- Play chess against an AI in the terminal
- Two player mode (run
chess --two
to enter) - possible commands:
a3
,Nc3
,Qxa
, etc: make a movel
: prints every legal mover
: make a random moveu
: undo your last movequit
: resign the current gamegm
: prints moves of current game in PGN format?
: help, prints all available commands
Initial State:
First move:
Install from PyPI
Just run the following command:
pip install cl-chess
- 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 .
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!
Contributions are always welcome!
See CONTRIBUTING.md
for ways to get started.
Please adhere to this project's CODE-OF-CONDUCT.md
.
Take a look at the LICENSE file
Please create an issue.
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.