GithubHelp home page GithubHelp logo

amanjpro / zahak Goto Github PK

View Code? Open in Web Editor NEW
30.0 10.0 11.0 13.39 MB

A UCI compatible chess AI in Go

Home Page: https://zahak.amanj.me

License: MIT License

Go 66.79% Makefile 0.49% Shell 0.03% C 25.81% Assembly 4.99% C++ 1.90%
chess chess-engine uci-chess-engine uci-protocol nnue neural-networks

zahak's Introduction

Zahak

Build Status

A UCI compatible chess AI written in Go. Still work in progress.

Courtesy to the OpenBench community, Zahak is now part of the official OpenBench instance

The name

Zahak (or Zahhak or Azhi Dahak) is an evil figure in Iranian/Kurdish/Perisan mythology, evident in ancient Iranian folklore as Azhi Dahāka, the name by which he also appears in the texts of the Avesta. Legend has it, that he had two giant snakes on his shoulders and he had to feed them two human brains on daily basis, you can read more about him here

Play Zahak online

Zahak is new to LiChess, you can play him and be impressed with him. His LiChess handle is zahak_engine.

Play Zahak on your Android Phone/Desktop

Zahak is a bare chess engine AI, that means it doesn't come with any GUI interface. That also means, it is easy to plug it into any chess GUI that supports UCI protocol.

Tournaments

Zahak recently got invitation to the TCEC tournament!

Zahak is also participating in ZaTour tournament series for open source and original chess engines. And many other tournaments, like the ones arranged by the amazing Graham Banks.

Rating

Zahak is in almost all major rating lists, here are the details:

version CCRL Blitz Rating CCRL Blitz (8CPU) Rating CCRL 40/40 Rating CCRL 40/4040 (4CPU) Rating
9.x 3278 3406 3213 3282
8.x 3133 N/A 3098 N/A
7.x 2964 (32 bit: 2897) N/A 2938 3006
6.x 2833 N/A 2800 (unstable rating) N/A
5.0 2730 N/A 2676 N/A
4.0 2570 N/A 2568 (unstable rating) N/A
3.0 2407 N/A N/A N/A
2.0.0 2105 (unstable rating) N/A N/A N/A
1.0.0 2011 N/A N/A N/A
0.3.0 1922 N/A N/A N/A
0.2.1 1824 N/A N/A N/A
version CEGT 40/4 Rating CEGT 40/20 Rating CEGT 5"+3' Rating (Ponder On)
9.x 3182 3162 3199
8.x 3046 3022 3051
7.x 2840 N/A 2858
6.x 2664 N/A 2676
5.0 2553 N/A N/A
4.0 2417 N/A N/A
  • Other well-known rating lists
version GRL 40/2 Rating SPCC Rating BRUCE Rating Fast GM 60+06 Fast GM 10m+6s
9.x 3244 3273 3283 N/A 3138
8.x 3140 N/A 3169 N/A 3057
7.x 2929 N/A 2981 2749 N/A
6.x 2785 N/A 2841 2584 2720
5.0 2686 N/A 2683 2505 N/A
4.0 2522 N/A N/A N/A N/A
3.0 2378 N/A N/A N/A N/A

Implemented Features:

Core Features

  • UCI Support
  • (Magic) Bitboards
  • Multi-stage move generation
  • Transposition Table
  • Pawnhash
  • PolyGlot opening book
  • Compliant with OpenBench
  • Syzygy Support
  • MultiPV
  • Skill Levels, 1 to 7 (strongest)

Search

Basics

  • Alpha-Beta search
  • Quiescence Search
  • Iterative Deepening
  • PV Search and PV
  • Search with Zero Windows
  • Aspiration Window with PVS
  • Pondering
  • Multi-Threading (LazySMP)

Move Ordering

  • Hash move
  • Promotions
  • Static Exchange Evaluation followed by LVA-MVV for equal captures according to SEE
  • Killer Moves Heuristics
  • Countermove Heuristics
  • Move History Heuristics
  • Countermove History Heuristics
  • FollowUp History Heuristics

Selectivity

  • Late Move Pruning
  • Null-Move Pruning
  • Delta Pruning
  • Reverse Futility Pruning
  • Futility Pruning
  • Late Move Reduction
  • Razoring
  • Check Extensions
  • Internal Iterative Deepening
  • SEE pruning both in QS and normal search
  • Threat Pruning
  • Singular Extension
  • Multi-Cut

Evaluation

  • NNUE

Command line options

bash-3.2$ bin/zahak -help
Usage of bin/zahak:
  Commands:
   ./zahak         Runs Zahak in UCI mode
   ./zahak bench   Runs Zahak in OpenBench mode
   
  Options:
  
  -book string
        Path to openning book in PolyGlot (bin) format
  -perft
        Provide this to run perft tests
  -perft-tree
        Run the engine in prefttree mode
  -gen-epds
        Generate opening EPDs for self-play
  -profile
        Run the engine in profiling mode
  -slow
        Run all perft tests, even the very slow tests
  -test-positions string
        Path to EPD positions, used to test the strength of the engine

Skill Levels

Anchored around Rustic Alpha 3, I found that, based on CCRL the ratings will probably translate to the following:

  • Skill Level 1: 1270
  • Skill Level 2: 1440
  • Skill Level 3: 1630
  • Skill Level 4: 1856
  • Skill Level 5: 2004
  • Skill Level 6: 2074

Opening Books

Currently only PolyGlot is supported. Then engine doesn't come with any books, but you can attach your favourite one easily by passing the path to -book command: zahak -book PATH_TO_BOOK.

A bunch of free books are available here

Training Networks

Please refer to this guide.

Building

To build the project, simply run make build, testing with make test, and running with make run. Other features exist, for example you can run perft with ./zahak -perft or profile it with ./zahak -profile. You can also run it in perfttree mode with ./zahak -preft-tree.

Contributors

Thanks to the following for their valuable contributions:

  • Basti Dangca: for generating data for training Zahak's network
  • Alan Cooper (Scally): for generating weaker networks for different skill levels.

Acknowledgement

Zahak wouldn't have been possible without:

  • VICE videos
  • Chess Programming Wiki
  • The official OpenBench instance, and the all the hardware donators (noopwn4ftw and others)
  • Aryan Parekh the author of Bit-Genie, who helped me with NNUE
  • Niels Abildskov the author of Loki, who helped me with Texel Tuning
  • Nasrin Zaza for the amazing logo
  • OpenSource engines like: Weiss, Ethereal, CounterGo, Cheng and Berserk (in no specific order)
  • OpenBench community on Discord
  • No4b for helping me with some evaluation terms

zahak's People

Contributors

amanjpro avatar gitter-badger avatar scallybag avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zahak's Issues

King-safety eval

King safety is important, the current open PR #11 should be improved and merged

Evaluation and best move differ in 2 GUIs

While testing the new Zahak v8.0 dev (by git clone & compile) i discovered a strange thing : it's evaluation and 'best move' differ when running in SCID and CuteChess.

I tested the following position : 8/p5pp/1pk1n3/5p2/P1n5/2NN2KP/5PP1/8 w - - 0 28

zahak_8 0-dev_in_scid

White to move. Here you see the output in SCID. For a long time Zahak considered Nb4+ best move. At a few depths it changed its mind to Nf4 or Kh4, but after all it decided Nb4+ was best. In SCID i let it run endlessly, and for my test i stopped the engine at depth 23 after 81 seconds. I used CuteChess for engine-vs-engine play (setting 120 sec per player for the whole game + 1 sec bonus) and here Zahak played h4 after 5.8 seconds, reaching depth 9 :

zahak_8 0-dev_in_cutechess

[Event "engine-vs-engine"]
[Site "?"]
[Date "2021.11.21"]
[White "Zahak v8.0 dev NNUE"]
[Black "TuxedoCat v0.0.2"]
[Result "1-0"]
[FEN "8/p5pp/1pk5/5p2/P1nn4/2NN3P/5PPK/8 w - - 0 27"]
[GameDuration "00:01:54"]
[PlyCount "43"]
[SetUp "1"]
[TimeControl "120+1"]

1. Kg3 {-2.02/9 8.2s} Ne6 {+1.00/4 0.22s} 2. h4 {-1.95/9 5.8s} Nc5 {+1.00/4 0.30s} 3. Nb4+ {-1.92/9 12s} Kb7 {+2.11/5 0.94s} 4. Kf4 {-1.77/10 7.9s} g6 {+1.00/4 0.26s} 5. Kg5 {-1.12/10 7.8s} a5 {+1.00/4 0.26s} 6. Nbd5 {-1.14/10 3.9s} Ne4+ {+0.05/4 0.26s} 7. Kh6 {+0.56/10 4.9s} Nxc3 {0.00/4 0.23s} 8. Nxc3 {+1.89/13 6.4s} Nb2 {+0.03/5 0.79s} 9. Kxh7 {+4.91/12 3.0s} f4 {-0.13/5 0.67s} 10. Kxg6 {+5.07/12 2.8s} Nd3 {-1.08/5 0.60s} 11. h5 {+6.54/12 5.4s} Nxf2 {-0.40/5 0.82s} 12. h6 {+13.33/12 3.2s} Nd3 {-0.40/5 0.85s} 13. h7 {+14.16/12 3.2s} Ne5+ {-3.45/5 1.1s} 14. Kf6 {+21.08/11 9.0s} f3 {-6.60/5 1.3s} 15. gxf3 {+22.55/11 2.2s} Nd7+ {-7.86/5 0.69s} 16. Kf5 {+22.46/12 2.7s} Nc5 {-9.08/5 0.52s} 17. h8=Q {+35.50/11 3.8s} Nd3 {-9.08/5 1.2s} 18. Nb5 {+M11/12 5.7s} Nb4 {-9.08/5 0.85s} 19. Qd8 {+M7/25 1.8s} Na6 {-9.08/5 0.72s} 20. Ke5 Nc5 {-12.08/4 0.31s} 21. Qc7+ {+M3/100 0.022s} Ka6 {-12.08/2 1.2s} 22. Qa7# {+M1/100 0.025s, White mates} 1-0

Note the starting position was 1 move earlier, but to consult SCID i entered the position that followed after 1 move.

The CuteChess screenshot shows that Zahak considered Nb4+ best move after 3 sec at depth 8, and h4 after 25 sec at depth 9, but to reproduce its behaviour and create the screenshot, i again let it run in CuteChess with much longer thinking time .. obviously it played h4 after 5.9 sec, not Nb4+. However, SCID shows h4 was never considered !? Also the evaluation in SCID (-2.07 after 4.31 sec at depth 17) differs from CuteChess (-1.95 after 5.8 sec at depth 9).

I have no clue how to explain this .. did i do a proper test? It seems Zahak (and maybe any engine) is running much faster in SCID and the evaluation differs a lot.

I'm on Xubuntu 20.04 64-bit. Both my GUIs are newest versions, i use same settings in both, eg. 64 Mb hash and MPV 1 and 1 thread.

Losing on time A LOT

I was testing 0.2.1 and 0.3.0 with Arena, ponder ON, 1 minute + 1 second and both versions tested lose on time all the time. Here is a grep of "time forfeit" on the generated PGN after some games:

263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]
263 - Zahak 0.3.0 Gauntlet.pgn:[Termination "time forfeit"]

incorrect move generation

Hi,

Using fen -> 8/8/5P2/3kP1K1/5Q2/8/6q1/8 w KQkq - 1 85

The engine produces a1-a5 as the best move.
The depths of 1 and 2 look fine but from 3 on it has these invalid moves.

From Engine: info depth 1 seldepth 5 hashfull 0 tbhits 0 nodes 451 nps 362364 score cp -175 time 1 multipv 1 pv f4g4 h8g8 g5h6
From Engine: info depth 1 seldepth 5 hashfull 0 tbhits 0 nodes 451 nps 362364 score cp -503 time 1 multipv 2 pv f4g3 g2g3 g5f5
From Engine: info depth 1 seldepth 5 hashfull 0 tbhits 0 nodes 451 nps 362364 score mate -2 time 1 multipv 3 pv g5f5 h8h5 f4g5
From Engine: info depth 1 seldepth 5 hashfull 0 tbhits 0 nodes 451 nps 362364 score mate -0 time 1 multipv 4 pv g5f5 h8h5 f4g5
From Engine: info depth 1 seldepth 5 hashfull 0 tbhits 0 nodes 451 nps 362364 score mate -0 time 1 multipv 5 pv g5f5 h8h5 f4g5
From Engine: info depth 2 seldepth 7 hashfull 0 tbhits 0 nodes 1374 nps 561774 score cp -175 time 2 multipv 1 pv f4g4 h8g8 g5h6 g2g4
From Engine: info depth 2 seldepth 7 hashfull 0 tbhits 0 nodes 1374 nps 561774 score mate -2 time 2 multipv 2 pv g5f5 h8h5 f4g5
From Engine: info depth 2 seldepth 7 hashfull 0 tbhits 0 nodes 1374 nps 561774 score mate -2 time 2 multipv 3 pv f4g3 g2g3 g5f5
From Engine: info depth 2 seldepth 7 hashfull 0 tbhits 0 nodes 1374 nps 561774 score mate -0 time 2 multipv 4 pv f4g3 g2g3 g5f5
From Engine: info depth 2 seldepth 7 hashfull 0 tbhits 0 nodes 1374 nps 561774 score mate -0 time 2 multipv 5 pv f4g3 g2g3 g5f5
From Engine: info depth 3 seldepth 11 hashfull 1 tbhits 0 nodes 69130 nps 928776 score cp 13157 time 74 multipv 1 pv a1a5 d5c6 f4c4 c6d7 a5a7 g2b7 a7b7 d7d8
From Engine: info depth 3 seldepth 11 hashfull 1 tbhits 0 nodes 69130 nps 928776 score cp 4626 time 74 multipv 2 pv a1d1 d5c5 h1h8 c5c6 f4c4 c6b6
From Engine: info depth 3 seldepth 11 hashfull 1 tbhits 0 nodes 69130 nps 928776 score cp 4625 time 74 multipv 3 pv e1c1 d5c5 f4d4 c5b5 h1h8 g2c6 c1d2
From Engine: info depth 3 seldepth 11 hashfull 1 tbhits 0 nodes 69130 nps 928776 score cp 4549 time 74 multipv 4 pv h1h8 g2g1 e1d2 g1g2 d2c3 d5e6
..

Starting at depth 3 its recommending invalid moves:
pv1 = a1a5 d5c6 f4c4 c6d7 a5a7 g2b7 a7b7 d7d8
pv2 = a1d1 d5c5 h1h8 c5c6 f4c4 c6b6
These are not valid moves for the fen

From Engine: id name Zahak 72ff806
From Engine: id author Amanj
From Engine: id EvalFile 134020434

Compile errors with Zahak-NNUE

Hi Amanj,

I’m following you NNUE branch with interest.

Up to yesterday it compiled fine, however with your latest commit 4b880b7, I get these errors on compiling:

engine/nn.go:6:22: cannot use [98304]float32{...} (type [98304]float32) as type []float32 in assignment
engine/nn.go:9840:21: cannot use [128]float32{...} (type [128]float32) as type []float32 in assignment
engine/nn.go:9856:22: cannot use [128]float32{...} (type [128]float32) as type []float32 in assignment
make: *** [Makefile:11: netgen] Error 2

Also I believe you need a “mkdir -p bin” in your Makefile under “dist: net gen” for the multiple Platform compiles as the bin folder doesn’t exist after a make clean.

I plan to run a cutechess tournament on my RPi 4 between your Zahak and Zahak-NNUE engines.

Al.

Compile issues on RPi 32 bit since commit d46bc7b2d176f7efc71eaaedd9aefa8850ab5efa

Hi Amanj,

Since commit d46bc7b I cannot compile Zahak without removing the -mavx from the CFLAGS in fathom.go

Al@RPi4-SSD:~/Engine-Source/zahak-nnue $ make -j5
go clean ./...
rm -f engine/nn.go
CC=cc CGO_ENABLED="1" go run -gcflags "-B" -ldflags "-X 'main.netPath=default.nn' -X 'main.Version=3253478557873477dc3908536cc02ca9e1a6b447'" netgen/nn.go
mkdir -p bin
CC=cc CGO_ENABLED="1" go build -gcflags "-B" -o bin ./...

github.com/amanjpro/zahak/fathom

cc: error: unrecognized command line option '-mavx'; did you mean '-marm'?
make: *** [Makefile:31: build] Error 2

———-

Al@RPi4-SSD:~/Engine-Source/zahak-nnue $ make cross-build -j5
go clean ./...
rm -f engine/nn.go
mkdir -p bin
echo "!!!! WARNING !!!! Cross build will not support Syzygy Probing"
!!!! WARNING !!!! Cross build will not support Syzygy Probing
CC=cc CGO_ENABLED="1" go run -ldflags "-X 'main.netPath=default.nn' -X 'main.Version=7.1'" netgen/nn.go
CC=cc CGO_ENABLED="1" GOOS=linux GOARCH=arm go build -gcflags "-B" -o bin ./... && mv bin/zahak bin/zahak-linux-arm32

github.com/amanjpro/zahak/fathom

cc: error: unrecognized command line option '-mavx'; did you mean '-marm'?
make: *** [Makefile:62: cross-build] Error 2
Al@RPi4-SSD:~/Engine-Source/zahak-nnue $

———-

However when I remove this flag, I can compile for 32 bit ONLY, I get these errors on trying the cross-build make

Al@RPi4-SSD:~/Engine-Source/zahak-nnue $ make cross-build -j5
go clean ./...
rm -f engine/nn.go
mkdir -p bin
echo "!!!! WARNING !!!! Cross build will not support Syzygy Probing"
!!!! WARNING !!!! Cross build will not support Syzygy Probing
CC=cc CGO_ENABLED="1" go run -ldflags "-X 'main.netPath=default.nn' -X 'main.Version=7.1'" netgen/nn.go
CC=cc CGO_ENABLED="1" GOOS=linux GOARCH=arm go build -gcflags "-B" -o bin ./... && mv bin/zahak bin/zahak-linux-arm32
CC=cc CGO_ENABLED="1" GOOS=linux GOARCH=arm64 go build -gcflags "-B" -o bin ./... && mv bin/zahak bin/zahak-linux-arm64

runtime/cgo

In file included from _cgo_export.c:4:
cgo-gcc-export-header-prolog:25:14: error: size of array ‘_check_for_64_bit_pointer_matching_GoInt’ is negative
make: *** [Makefile:63: cross-build] Error 2

———-

Thanks,

Al.

Doesn't work on my XEON 3680

I'm testing the AMD 64 compile; the previous versions work fine.

uci
id name Zahak 7.0
id author Amanj
id EvalFile 2288800614
option name Ponder type check default false
option name Hash type spin default 128 min 1 max 24000
option name Book type check default false
option name Threads type spin default 1 min 1 max 6
option name EvalFile type string
option name BookFile type string
uciok
isready
readyok
position startpos
go wtime 30000
Exception 0xc000001d 0x0 0x0 0x4f9aff
PC=0x4f9aff

github.com/amanjpro/zahak/engine._quick_feed(0xc010394800, 0x80, 0xc000124200, 0x80, 0xc008335b3c)
/home/runner/work/zahak/zahak/engine/nnue_instructions_amd64.s:250 +0x1f
github.com/amanjpro/zahak/engine.(*NetworkState).QuickFeed(0xc010384090, 0x0)
/home/runner/work/zahak/zahak/engine/nnue_instructions_amd64.go:36 +0x98
github.com/amanjpro/zahak/engine.(*Position).Evaluate(0xc00004c2c0, 0xd29ddaaa4b272c47)
/home/runner/work/zahak/zahak/engine/evaluation.go:50 +0x175
github.com/amanjpro/zahak/search.(*Engine).alphaBeta(0xc000136000, 0x7fff80010001, 0x1)
/home/runner/work/zahak/zahak/search/search.go:283 +0x2da
github.com/amanjpro/zahak/search.(*Engine).aspirationWindow(0xc000136000, 0x18001, 0x64)
/home/runner/work/zahak/zahak/search/search.go:166 +0x206
github.com/amanjpro/zahak/search.(*Engine).rootSearch(0xc000136000, 0x10164)
/home/runner/work/zahak/zahak/search/search.go:123 +0x218
github.com/amanjpro/zahak/search.(*Engine).Search(0xc000136000, 0x64)
/home/runner/work/zahak/zahak/search/search.go:40 +0x65
github.com/amanjpro/zahak/search.(*Runner).Search(0xc0081f6000, 0x7564)
/home/runner/work/zahak/zahak/search/search.go:16 +0x145
created by github.com/amanjpro/zahak/uci.(*UCI).findMove
/home/runner/work/zahak/zahak/uci/uci.go:241 +0x849

goroutine 1 [syscall, locked to thread]:
syscall.Syscall6(0x76fda740, 0x5, 0x3, 0xc00830c000, 0x1000, 0xc00000a07c, 0x0, 0x0, 0x0, 0x0, ...)
/opt/hostedtoolcache/go/1.16.8/x64/src/runtime/syscall_windows.go:343 +0xf2
syscall.ReadConsole(0x3, 0xc00830c000, 0x1000, 0xc00000a07c, 0x0, 0x5, 0x2)
/opt/hostedtoolcache/go/1.16.8/x64/src/syscall/zsyscall_windows.go:982 +0xd5
internal/poll.(*FD).readConsole(0xc000110000, 0xc00830a000, 0x1000, 0x1000, 0x29640aa8, 0xc008200000, 0x0)
/opt/hostedtoolcache/go/1.16.8/x64/src/internal/poll/fd_windows.go:478 +0x23c
internal/poll.(*FD).Read(0xc000110000, 0xc00830a000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
/opt/hostedtoolcache/go/1.16.8/x64/src/internal/poll/fd_windows.go:425 +0x137
os.(*File).read(...)
/opt/hostedtoolcache/go/1.16.8/x64/src/os/file_posix.go:31
os.(*File).Read(0xc000006010, 0xc00830a000, 0x1000, 0x1000, 0x2030000, 0x6d8188, 0x4145d5)
/opt/hostedtoolcache/go/1.16.8/x64/src/os/file.go:117 +0x85
bufio.(*Reader).fill(0xc008337d68)
/opt/hostedtoolcache/go/1.16.8/x64/src/bufio/bufio.go:101 +0x10d
bufio.(*Reader).ReadSlice(0xc008337d68, 0x40dd0a, 0xc000051f40, 0x50, 0x48, 0x5388c0, 0xc000004001)
/opt/hostedtoolcache/go/1.16.8/x64/src/bufio/bufio.go:360 +0x45
bufio.(*Reader).collectFragments(0xc008337d68, 0x44400a, 0xc0083379c0, 0x464320, 0xc008337a08, 0xc008337a10, 0x10, 0xc00
0032000, 0x50ccc9, 0xc008337a98, ...)
/opt/hostedtoolcache/go/1.16.8/x64/src/bufio/bufio.go:435 +0x85
bufio.(*Reader).ReadString(0xc008337d68, 0xc00004c20a, 0x6cff60, 0x0, 0x0, 0x1)
/opt/hostedtoolcache/go/1.16.8/x64/src/bufio/bufio.go:483 +0x53
github.com/amanjpro/zahak/uci.(*UCI).Start(0xc00004c000)
/home/runner/work/zahak/zahak/uci/uci.go:50 +0x1d3
main.main()
/home/runner/work/zahak/zahak/zahak/main.go:89 +0x5d4
rax 0x80
rbx 0xc010394800
rcx 0x80
rdi 0xc010394800
rsi 0x80
rbp 0xc008335b40
rsp 0xc008335b08
r8 0xc008335b3c
r9 0x1
r10 0x8
r11 0x2
r12 0x2
r13 0x2
r14 0x9
r15 0xffffffffffffffff
rip 0x4f9aff
rflags 0x10202
cs 0x33
fs 0x53
gs 0x2b

Problem under Fritz

When Zahak is started from the command line it displays a lot of characters probably intended to show its name. I guess that may be responsible for the engine exiting under Fritz every time with some exception.
I'm not sure because this occurs only when playing engine tournaments, it did not occur when I myself played against Zahak. Could be some UCI implementation issue, e.g. wrong order of commands at start time.

Opening book

Without supporting opening book, Zahak is not going to be competitive. Initially we will support PolyGlot only

Micro optimizations

There are lots of possible rooms for improvement, one might want to try:

  • Many of the receivers of methods are unnecessarily pointers, especially the ones about Move. This might warrant some care
  • struct and method/function alignment is not at all being considered, we probably want to revisit it

LMR+PVS

I think, if LMR>0, research should be if score > alpha without score < beta. Or I do not understand how it works :-).

score := -e.alphaBeta(depthLeft-1-LMR, searchHeight+1, -alpha-1, -alpha)
if score > alpha && (LMR>0||score < beta) {
...
}

zahak/search/search.go

Lines 745 to 751 in 72ff806

score := -e.alphaBeta(depthLeft-1-LMR, searchHeight+1, -alpha-1, -alpha)
e.pred.Pop()
if score > alpha && score < beta {
// research with window [alpha;beta]
e.pred.Push(position.Hash())
e.innerLines[searchHeight+1].Recycle()
score = -e.alphaBeta(depthLeft-1, searchHeight+1, -beta, -alpha)

Raspberry Pi 4 32 bit compile problems

Hi,

whenever I try to compile your engine I get these errors:

Al@RPi4-SSD:~/go $ go get -u github.com/amanjpro/zahak/zahak

github.com/amanjpro/zahak/engine

src/github.com/amanjpro/zahak/engine/cache.go:32:27: syntax error: unexpected b1111111111111111111111111111 after top level declaration
src/github.com/amanjpro/zahak/engine/cache.go:33:27: syntax error: unexpected b1111111111111111 after top level declaration
src/github.com/amanjpro/zahak/engine/cache.go:34:28: syntax error: unexpected b1111111 after top level declaration
src/github.com/amanjpro/zahak/engine/cache.go:35:27: syntax error: unexpected b111 after top level declaration
src/github.com/amanjpro/zahak/engine/cache.go:36:26: syntax error: unexpected b1111111111 after top level declaration

Also I’ve tried your provided binaries for 32bit and 64bit for v5 and v6 but neither run on Raspberry Pi 4, which is completely up to date running Raspbian OS 32bit.

Thanks,

Al.

Endgame TB

Zahak needs support for Endgame tablebase

Zahak can sometimes make an illegal move

Since, the way I "validate" moves are very inefficient (I basically generate every move, and make sure that the PGN move is valid, and then play it). When in a very serious time-trouble Zahak might not be able to make all the moves that he recieves from position startpos moves ... command, before recieving a stop command, which might make him play an illegal move.

One solution is basically to trust the GUI and play the moves one by one (of course caring about castling and captures), and only for the last move to care if the position is in check

+250-300?

Hi Amanj,

This might not be very useful to you but still.

You claimed a 250-300 Elo improvement by v1.0.0 over v0.3.0. Therefore for my current tournament I selected opponents in the 2160-2200 range (to be on the safe side). However, even this selection has proved too strong. At the time of writing Zahak has a score of 6 out of 30.
I watched some of the games. It is hard to point to a salient problem. It seemes to me one of the problems is in endgames with passed pawns. Also, somehow the depth reached is less than that of most of the opponents. Zahak seems to fall for traps.

I may send you the PGN if you are interested. You can find my e-mail address in my CCC profile.

Best regards,
Gabor

Trapped pieces

Trapped pieces are nasty, they can be very hard to be avoided using search only, eval needs to recognize them

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.