Libraryless. Click here for Pure Java version (1255L/9K/29K).
1 | !752 |
2 | |
3 | !include #1001500 // Stockfish |
4 | |
5 | p {
|
6 | Stockfish client = new Stockfish(); |
7 | String FEN = "8/6pk/8/1R5p/3K3P/8/6r1/8 b - - 0 42"; |
8 | |
9 | // initialize and connect to engine |
10 | if (client.startEngine()) {
|
11 | System.out.println("Engine has started..");
|
12 | } else {
|
13 | System.out.println("Oops! Something went wrong..");
|
14 | } |
15 | |
16 | // send commands manually |
17 | client.sendCommand("uci");
|
18 | |
19 | // receive output dump |
20 | System.out.println(client.getOutput(0)); |
21 | |
22 | // get the best move for a position with a given think time |
23 | System.out.println("Best move : " + client.getBestMove(FEN, 100));
|
24 | |
25 | // get all the legal moves from a given position |
26 | System.out.println("Legal moves : " + client.getLegalMoves(FEN));
|
27 | |
28 | // draw board from a given position |
29 | System.out.println("Board state :");
|
30 | client.drawBoard(FEN); |
31 | |
32 | // get the evaluation score of current position |
33 | System.out.println("Evaluation score : " + client.getEvalScore(FEN, 2000));
|
34 | |
35 | // stop the engine |
36 | System.out.println("Stopping engine..");
|
37 | client.stopEngine(); |
38 | } |
download show line numbers debug dex old transpilations
Travelled to 17 computer(s): agxbjmyenqqu, aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1001501 |
| Snippet name: | Test Stockfish |
| Eternal ID of this version: | #1001501/1 |
| Text MD5: | a904dd49b1249b9e629f6aec6d372c0c |
| Transpilation MD5: | db649a37e145c8b4fcedf49707487847 |
| Author: | stefan |
| Category: | |
| Type: | JavaX source code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2016-07-03 14:53:24 |
| Source code size: | 1037 bytes / 38 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1211 / 1174 |
| Referenced in: | [show references] |