libedax4dart 7.33.2 copy "libedax4dart: ^7.33.2" to clipboard
libedax4dart: ^7.33.2 copied to clipboard

Dart wrapper for libedax. With using libedax4dart, you can execute functions equivalent to edax.

example/example.dart

import 'dart:io';

import 'package:libedax4dart/libedax4dart.dart';

void main() {
  // initialize
  const initParams = [
    '',
    '-book-file',
    './resources/test_book.dat',
    '-level',
    '16'
  ];
  final edax = LibEdax()
    ..libedaxInitialize(initParams)
    ..edaxInit()
    ..edaxOptionsDump();
  stdout.writeln(edax.edaxGetBoard().prettyString(edax.edaxGetCurrentPlayer()));

  /// play
  edax
    ..edaxPlay('f5f6f7g7')
    ..edaxPlayPrint();

  stdout
    ..writeln(edax.edaxGetBoard().prettyString(edax.edaxGetCurrentPlayer()))
    ..writeln('moves: ${edax.edaxGetMoves()}')
    ..writeln('is game over ?: ${edax.edaxIsGameOver() ? 'YES' : 'NO'}')
    ..writeln('can move ?: ${edax.edaxCanMove() ? 'YES' : 'NO'}')
    ..writeln('BLACK discs: ${edax.edaxGetDisc(TurnColor.black)}')
    ..writeln('White discs: ${edax.edaxGetDisc(TurnColor.white)}');

  /// get hints
  final hintList = edax.edaxHint(2);
  stdout
    ..writeln(
      '1st move: ${hintList.first.moveString}, ${hintList.first.scoreString}',
    )
    ..writeln(
      '2nd move: ${hintList[1].moveString}, ${hintList[1].scoreString}',
    );
}
4
likes
160
points
1.49k
downloads

Publisher

verified publisherdone-sensuikan1973.com

Weekly Downloads

Dart wrapper for libedax. With using libedax4dart, you can execute functions equivalent to edax.

Repository (GitHub)
View/report issues

Topics

#reversi #edax

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

ffi, meta

More

Packages that depend on libedax4dart