chess 0.6.4

  • README.md
  • Installing
  • Versions
  • 64

chess.dart

chess.dart is a library for legal chess move generation, maintenance of chess game state, and conversion to and from the formats FEN and PGN. It has no external dependencies.

It is a port of chess.js to Dart. It aims to include all of the functionality in the original library, while making the API a little bit more Dart-like. In limited testing, the Dart version (after some refactoring) now outperforms the JavaScript original.

At this early stage, it is working, and passes all of the unit tests which come with chess.js (which you can find in the test directory). However, beyond this, it is not tested in production.

A Random Game

import "package:chess/chess.dart";

void main() {
  Chess chess = new Chess();
  while (!chess.game_over) {
    print('position: ' + chess.fen);
    print(chess.ascii);
    var moves = chess.moves();
    moves.shuffle();
    var move = moves[0];
    chess.move(move);
    print('move: ' + move);
  }
}

Documentation

The chess.js documentation is largely relevant, but there are also DartDocs generated within the lib/docs directory. The only change in naming from chess.js, is that history() has been changed to getHistory() due to a conflict with the history ivar and some methods have been changed into properties.

The test directory contains tests.dart which is a port of chess.js's unit tests. The program random.dart plays a random game of chess. ai.dart is an example of a simple 4 ply alpha beta search for black (yes a simple chess-playing program) that uses a purely material evaluation function (it is rather slow).

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  chess: "^0.6.4"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:chess/chess.dart';
  
Version Uploaded Documentation Archive
0.6.4 Feb 7, 2018 Go to the documentation of chess 0.6.4 Download chess 0.6.4 archive
0.6.3 Sep 7, 2017 Go to the documentation of chess 0.6.3 Download chess 0.6.3 archive
0.6.2 Jul 23, 2014 Go to the documentation of chess 0.6.2 Download chess 0.6.2 archive
0.6.1 Jul 6, 2014 Go to the documentation of chess 0.6.1 Download chess 0.6.1 archive
0.6.0 Apr 12, 2014 Go to the documentation of chess 0.6.0 Download chess 0.6.0 archive
0.5.1 Feb 7, 2014 Go to the documentation of chess 0.5.1 Download chess 0.5.1 archive
0.5.0 Feb 1, 2014 Go to the documentation of chess 0.5.0 Download chess 0.5.0 archive
0.0.2 Jan 31, 2014 Go to the documentation of chess 0.0.2 Download chess 0.0.2 archive
0.0.1 Jan 31, 2014 Go to the documentation of chess 0.0.1 Download chess 0.0.1 archive

Analysis

We analyzed this package on May 22, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
36 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80 / 100
Overall score:
Weighted score of the above. [more]
64
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:chess/chess.dart.

Suggestions

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 7 hints.

    Run dartfmt to format lib/chess.dart.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use chess.dart.

Dependencies

Package Constraint Resolved Available
Dev dependencies
benchmark_harness >=1.0.0 <1.1.0
unittest >=0.9.3