パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.8.1

chess

合法なチェス手の生成、チェスゲーム状態の管理、およびFENとPGNフォーマット間の変換を行うためのライブラリ。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
1.2万
いいね数
47
Pub ポイント
125

パッケージをインストール

flutter pub add chess

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

チェスパッケージは、チェスゲームの状態を管理し、合法手を生成し、FEN(フォースシー・エドワーズ表記法)とPGN(ポータブルゲーム表記法)の間で変換するためのDartライブラリです。正確な手の検証と状態追跡を備えたチェスアプリケーションの構築に堅実な基盤を提供します。正確なチェス論理が必要なチェスゲームやツールを開発する開発者にとって理想的であり、モバイル、Web、デスクトップなど複数のプラットフォームをサポートしています。このライブラリは文書化が充実しており、メンテナンスも行われており、Flutterプロジェクトへの統合が容易です。

用途

  • チェスゲームの構築
  • PGN ファイルの解析と生成
  • チェスの手を検証する
  • FEN と PGN の間での変換
  • チェスAIの実装
  • ゲーム状態の追跡

主な機能

  • 合法な手の生成
  • FENおよびPGN変換
  • ゲーム状態の管理
  • クロスプラットフォーム対応
  • 正確なチェスルールの実行
  • 軽量で高速

適している対象

  • Flutter ゲーム開発者
  • チェスアプリの作成者
  • 教育用チェスツール
  • チェスエンジンの統合
  • パズルとトレーニングアプリ

注意事項

  • チェス表記の理解が必要です
  • 標準チェスルールに限定
  • 組み込みのUIコンポーネントなし
  • 大規模なゲームデータベースには最適化されていません
  • 外部のソースコードメンテナンスに依存しています

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

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

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト