/ChessGame

Library for playing chess games or simulating chess AI

Primary LanguagePythonMIT LicenseMIT

Build Status Coverage Status Code Health

ChessGame

Library for running chess simulations. Allows customizable AI including random choice and minimax (with variable depth).

Getting Started

Install with pip

$pip install ChessGame

Or clone repo using git.

$git clone https://github.com/pelletier2017/ChessGame.git

Example Usage with 2 players

import chess.player as player
from chess.game import ChessGame

p1 = player.Player()
p2 = player.Player()

# setup game
game = ChessGame(p1, p2, first_move=1)

# useful attributes
curr_player = game.player_turn
player1_pieces = game.p1_pieces
player2_pieces = game.p2_pieces
all_pieces = game.pieces
moves = game.possible_moves

# performs moves in game
game.do_move("b2 b4")

p2_moves = game.possible_moves
game.do_move("c7 c6")

Example with two AI players

import chess.player as player
from chess.game import ChessGame

p1 = player.RandomComputer()
p2 = player.BasicMinimax()
game = ChessGame(p1, p2)
game.play()

Prerequisites

Dependencies are found in requirements.txt

$pip install -r requirements.txt

Running the tests

Tests are discovered using tox. It will take a while the first time to build virtual envs to run tests.

$tox

Travis CI will run tests automatically when changes are pushed to github.

travis-ci.org/pelletier2017/ChessGame

And coding style tests

Landscape evaluates code quality including code style. Project goal is to stay above 95%.

landscape.io/github/pelletier2017/ChessGame

Coveralls evaluates code coverage. Project goal is to stay above 80%.

coveralls.io/github/pelletier2017/ChessGame

Built With

Contributing

Contributing guide coming later.

License

This project is licensed under the MIT License - see the LICENSE.md file for details