패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.8.1

chess

합법적인 체스 수의 생성, 체스 게임 상태 유지 및 FEN과 PGN 형식 간 변환을 위한 라이브러리입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
1.2만
좋아요
47
Pub 점수
125

패키지 설치

flutter pub add chess

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

체스 패키지는 체스 게임 상태를 관리하고, 합법적인 수를 생성하며, FEN(Forsyth-Edwards Notation)과 PGN(포터블 게임 표기법) 형식 간에 변환하기 위해 설계된 Dart 라이브러리입니다. 정확한 수 검증과 상태 추적 기능을 갖춘 체스 애플리케이션 개발을 위한 견고한 기반을 제공합니다. 정밀한 체스 논리를 필요로 하는 체스 게임이나 도구를 개발하는 개발자에게 이상적이며, 모바일, 웹, 데스크톱 등 다양한 플랫폼을 지원합니다. 문서화가 잘 되어 있고 지속적으로 유지보수되므로 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

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트