Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gmitch215/chess-py

 
 

chess-py

MIT License

A python program to play chess against an AI in the terminal.

This is a fork of marcusbuffett/command-line-chess with significant improvements, serving as my Q3 Capstone project for AP Computer Science Principles.

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:

Initial

First move:

First move

Installation

  • First clone the repository:
git clone https://github.com/gmitch215/chess-py
  • navigate into the newly created chess-py directory and run:
pip install .

Usage

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!

LICENSE

Take a look at the LICENSE file

Authors

AI

The AI is a simple brute-force AI with min-max 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.

About

2025 Q3 Capstone Project

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages

  • Python 100.0%