Giter VIP home page Giter VIP logo

chess-bot's Introduction

chess-bot

Oyvind App Chess.jpg

Introduction

This is a Chess game in which you play aginst the computer. Apart from the game logic, which uses the chess.js library, I've made everything myself, including the whole interface, and the AI.

Getting started

Simply download the index.html file and open it in a browser. Alternatively, you can copy all the code in index.html into any JavaScript-compatible HTML editor, or you can simply play on https://oyvind.app/chess

Chess-bot.jpg

How to play

  1. The simplest way is to first click the square from which you want to move, and then click the square you want to move to.
  2. You can also move pieces by typing the move into the text input field below the board. The input field accepts Forsyth-Edwards Notation, as well as any command stating the square you're moving from and the square to which you want to move.

How does it work

Version 1

  • Minimax
  • Search depth: 4
  • Alpha-beta pruning
  • Evaluation: Aggregated value of pieces

Version 2

  • Minimax
  • Base search depth: 4
  • Alpha-beta pruning
  • Evaluation: Aggregated value of pieces
  • Quiescence search

Version 3

  • Minimax
  • Base search depth: 4
  • Alpha-beta pruning
  • Earlier alpha-beta cutoff by considering capture moves first
  • Caches scores of evaluated boards to prevent evaluating the same board multiple times
  • Evaluation: Aggregated value of pieces + number of possible moves for maximizing player - number of possible moves for minimizing player
  • Quiescence search

Version 4

  • Minimax
  • Base search depth: 4
  • Alpha-beta pruning
  • Earlier alpha-beta cutoff by considering capture moves first
  • Caches scores of evaluated boards to prevent evaluating the same board multiple times
  • Caches available moves for evaluated boards to prevent finding legal moves for the same board multiple times
  • Evaluation: Aggregated value of pieces + number of possible moves for maximizing player - number of possible moves for minimizing player
  • Quiescence search

How many moves ahead does the bot evaluate?

Right now, the bot thinks four moves ahead. The deeper the search, the more the alpha-beta comes into effect before searching deeper. I need to optimize the AI quite a bit before it's able to think further ahead. At the top of the chess-bot-x.html file, there is a line let NUMBEROFPLYS = 4; To make the bot search 6 moves forwards, simply change 4 to 6. I'm not quite sure, but the bot might only accept an even depth.

chess-bot's People

Contributors

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