Code Monkey home page Code Monkey logo

chess-ai-1's Introduction

Python3 Chess AI

Can beat me at bullet, maybe rated 1200-1400. Search is 3-ply full with a 5-ply beam(x10).

Nice TODO

  • Value function in play.py/ClassicValuator, plenty of room for improvement.
  • Add Quiescence search to play decent endgame
  • Is there a bug which allows draws to happen?

Usage

 pip3 install python-chess torch torchvision numpy flask
 # then...
 ./play.py   # runs webserver on localhost:5000

Or with pypy (for max speed)

 pip_pypy install python-chess flask
 pypy ./play.py
 # web browse to localhost:5000

TODOs

  • Roll out search beyond 1-ply
  • Make trainer multi GPU
  • Train on more data
  • Add RL self play learning support

Implementation

A simple 1 look ahead neural network value function. The trained net is in nets/value.pth. It takes in a serialized board and outputs a range from -1 to 1. -1 means black is win, 1 means white is win.

Serialization

We serialize the board into a 8x8x5 bitvector. See state.py for how.

Training Set

The value function was trained on 5M board positions from http://www.kingbase-chess.net/

chess-ai-1's People

Contributors

torbet 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.