Pakete, Repositories und App-Kategorien suchen

Paketdetailsv0.8.1

chess

Eine Bibliothek zur Generierung legaler Schachzüge, zum Erhalt des Schachspielzustands und zur Konvertierung zwischen den Formaten FEN und PGN.

AndroidiOSWebmacOSWindowsLinux
30-Tage-Downloads
11.600
Likes
47
Pub-Punkte
125

Paket installieren

flutter pub add chess

Paketübersicht

Aus öffentlichen Paketdaten erstellte Orientierung.

Das Schach-Paket ist eine Dart-Bibliothek, die entwickelt wurde, um Schach-Spielzustände zu verwalten, legale Züge zu generieren und zwischen den Formaten FEN (Forsyth-Edwards-Notation) und PGN (Portable Game Notation) zu konvertieren. Es bietet eine robuste Grundlage für die Entwicklung von Schach-Anwendungen mit genauer Zugüberprüfung und Zustandsverfolgung. Ideal für Entwickler, die Schachspiele oder Werkzeuge erstellen, die präzise Schachlogik erfordern, unterstützt es mehrere Plattformen wie Mobilgeräte, Web und Desktop. Die Bibliothek ist gut dokumentiert und wird kontinuierlich gepflegt, was die Integration in Flutter-Projekte erleichtert.

Anwendungsfälle

  • Schachspiele erstellen
  • Parsing und Generierung von PGN-Dateien
  • Schachzüge überprüfen
  • Konvertieren zwischen FEN und PGN
  • Implementierung von Schach-KI
  • Spielzustand verfolgen

Hauptmerkmale

  • Generierung legaler Züge
  • FEN- und PGN-Umwandlung
  • Spielzustandsverwaltung
  • Plattformübergreifende Unterstützung
  • Genauige Durchsetzung der Schachregeln
  • Leicht und schnell

Geeignet für

  • Flutter-Spieleentwickler
  • Schachanwendungsersteller
  • Pädagogische Schachwerkzeuge
  • Schach-Engine-Integrationen
  • Puzzle- und Trainings-Apps

Hinweise

  • Kenntnisse der Schachnotation erforderlich
  • Beschränkt auf die Standardregeln des Schach
  • Keine integrierten Benutzeroberflächenkomponenten
  • Nicht für große Spiel-Datenbanken optimiert
  • Abhängig von der externen Wartung des Quellcodes

Original-README

Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.

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.

In 2014, chess.dart started as a port of chess.js to Dart, including all of the functionality in the original library, while making the API a little bit more Dart-like. It has since accumulated bug fixes and performance improvements thanks to contributions from the Dart community.

chess.dart includes a test suite composed of all of the original chess.js unit tests as well as newer tests specific to bug fixes and feature additions specific to the Dart version (which you can find in the test directory). chess.dart is depended upon by multiple popular packages for chess board display.

Installation

The package is just called chess on pub. If for some strange reason you can't use pub, you can also just add the chess.dart file from the lib directory to your project. Adding the pub package is:

 $ dart pub add chess

Or you can manually add chess to your pubspec.yaml.

Then importing chess.dart in your code is simply:

import 'package:chess/chess.dart';

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.

Versioning

chess.dart version 0.6.5 and above requires Dart 2. For Dart 1, use version 0.6.4.

Testing

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). You can run the unit tests using pub:

pub get
dart run test/tests.dart

And you can also run performance tests.

dart run test/perft.dart

And, finally you can run the simple AI:

dart run test/ai.dart

Links

Kategorien

Quell-Repository

Projekte, die dieses Paket verwenden