generated from sensuikan1973/dart-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.dart
42 lines (37 loc) · 1.1 KB
/
example.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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}',
);
}