Skip to content
Branch: master
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Flywheel - An HTML5/Javascript chess engine

Flywheel is a pure Javascript chess engine (still in development).

Try out the online demo.

Flywheel chess engine demo

Design goals

  • Computer plays chess with adjustable skill level.
    • AI runs in Javascript background worker.
    • Strong enough to be a challenge for most people.
    • Can decrease strength so weaker players can beat it.
  • Also enables creating chess-related HTML5 apps that don't play chess, but just need to know about chess rules.
  • No built-in user interface - can be adapted to any UI you want.
  • No dependencies on other Javascript libraries (pure Javascript/HTML5). Vanilla JS
  • Fully understands all rules of chess.
    • Generates a list of all legal moves for any chess position.
    • Verifies whether an externally-supplied move is legal or not.
    • Makes and unmakes moves on the board.
    • Determines whether the game has ended by
      • Checkmate
      • Unambiguous draws, i.e., other than by agreement (that's up to the user interface).
      • Draw by Stalemate.
      • Draw by threefold repetition.
      • Draw by 50-move rule.
      • Draw by insufficient material: neither player has material to checkmate the other.
  • Forsyth–Edwards Notation (FEN): parse FEN into a chess position, and for any chess position, generate FEN.
  • Portable Game Notation (PGN): parse PGN from a game to reconstruct the game state, and generate PGN from a board position.

Running unit tests

The unit tests exercise the Flywheel engine. Some of the tests require Javascript Workers, which means most browsers, for security reasons, will refuse to run them directly from the local filesystem. Other tests will run fine from the local filesystem. The easiest way to run all the tests consistently is to run a local http server. I use Python 2.7 to serve content directly from the cloned repository, though there are many other ways.

cd ~
git clone https://github.com/cosinekitty/flywheel.git
cd flywheel
python -m SimpleHTTPServer 5432

Then you can run the unit tests in your browser:

Here is what a successful test looks like:

Successful unit test

About

A chess engine for the web browser

Resources

License

Releases

No releases published
You can’t perform that action at this time.