Skip to content

Library for playing chess games or simulating chess AI

License

Notifications You must be signed in to change notification settings

pelletier2017/ChessGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Library for playing chess games or simulating chess AI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages