Giter Club home page Giter Club logo

command-line-chess's Introduction

Run on Repl.it

command-line-chess

MIT License Maintenance made-with-python PRs Welcome PyPI download month PyPi version GitHub issues GitHub watchers GitHub stars

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

Also check out my other project, a chess training site.

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

Install from PyPI

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

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.mdfor ways to get started.

Please adhere to this project's CODE-OF-CONDUCT.md.

LICENSE

Take a look at the LICENSE file

Authors

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.

command-line-chess's People

Contributors

marcusbuffett avatar clasherkasten avatar ddugovic avatar djhenderson avatar jeromew21 avatar johndoknjas avatar gauthambellamkonda avatar aaaandrzej avatar programmin1 avatar pawelszulczewski avatar grbavacigla avatar aitorres avatar scientia-ac-labore avatar ste-t avatar innesgarmany avatar timgates42 avatar stjet avatar wobot1340 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.