dartshogi 0.1.0 copy "dartshogi: ^0.1.0" to clipboard
dartshogi: ^0.1.0 copied to clipboard

WIP - Provides shogi and shogi variants rules and operations including shogi move generation, read and write SFEN, USI, KIF/CSA.

example/dartshogi_example.dart

import 'package:dartshogi/dartshogi.dart';

void main() {
  // Parse sfen and create a valid shogi position
  final pos = parseSfen(Rule.shogi, initialSfen(Rule.shogi)).getOrThrow();

  // Generate all legal moves
  assert(pos.allMoveDests().length == 40);

  // Parse usi
  final move = MoveOrDrop.parse('7g7f')!;

  assert(pos.isLegal(move));

  // Play moves
  final pos2 = pos.play(move).getOrThrow();

  // Detect game end conditions
  assert(pos2.outcome() == null);
}
0
likes
150
points
105
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

WIP - Provides shogi and shogi variants rules and operations including shogi move generation, read and write SFEN, USI, KIF/CSA.

Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

lishogi.org

License

GPL-3.0 (license)

Dependencies

fast_immutable_collections, meta, result_dart

More

Packages that depend on dartshogi