GithubHelp home page GithubHelp logo

tbohne / chessai Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.64 MB

Trying to write a program that beats me at chess.

License: MIT License

Python 90.95% HTML 7.17% CSS 1.88%
chess ai machine-learning minimax

chessai's Introduction

ChessAI

example board


DEPENDENCIES

  • python-chess - move generation, move validation and support for common formats
  • flask - lightweight WSGI web application framework
  • torch - open source machine learning framework

USAGE

./server.py # runs webserver on localhost:5000

PROBLEM

Evaluate a given board state and come up with a good move to perform.

Why is it hard?

  • ~10^40 legal board states
  • ~10^120 different chess games
  • ~30 moves per board state
  • typical chess game ~80 moves

APPROACHES

  • Minimax

    • minimizing the possible loss for a worst case (maximum loss) scenario
    • reasonably works up to a search depth of 3
    • already surprinsingly good opponent, but beatable
    • improvement
      • alpha–beta pruning
      • decreases the number of nodes that are evaluated by minimax and therefore the computation time
      • allows to search faster and works reasonably up to a depth of 4
  • ANN

    • mapping to be learned: board state -> optimal move
    • needs a lot of chess games to train with
    • used PyTorch to implement the neural net

TRAINING DATA

The net was trained on 110000 standard rated games played on lichess.org in Portable Game Notation (PGN) format.
Therefore, based on the above assumptions, the model was trained on approximately 8.8M board positions.

chessai's People

Contributors

tbohne avatar

Watchers

 avatar

chessai's Issues

AI objective

Is 1-0 a win for white? Then the AI should go for the min value, otherwise max?
--> verify that it's correctly implemented..

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.