chess_lib 0.1.0+2 copy "chess_lib: ^0.1.0+2" to clipboard
chess_lib: ^0.1.0+2 copied to clipboard

Dart library for chess. Use this package for modelling a game of chess.

example/main.dart

import 'package:chess_lib/chess_lib.dart';

void main() {
  ChessGameState newGame = ChessGameState.initialBoardPosition();
  // play a few random moves
  List<ChessMove> movesPlayed = [];
  for (int i = 0; i < 5; i++) {
    List<ChessMove> moves = newGame.moves;
    moves.shuffle();
    movesPlayed.add(moves.first);
    newGame = newGame.playMove(moves.first);
  }
  // print the moves
  for (ChessMove m in movesPlayed) {
    print(m.moveString);
  }
  // print the current fen
  print(newGame.forsythEdwardsNotation);
}
3
likes
120
pub points
24%
popularity

Publisher

verified publisherthkp.co

Dart library for chess. Use this package for modelling a game of chess.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

More

Packages that depend on chess_lib