SnowballSH / Avalanche

UCI Chess Engine written in Zig.
MIT License
71 stars 4 forks source link

zig 0.13.0-dev.30+6fd09f8d2 #38

Closed giann closed 3 months ago

giann commented 5 months ago

Don't merge this yet. The following is panicking, I don't really know how to debug this @SnowballSH ?

Avalanche Compiled at 2024-04-25-13:52 by Yinuo Huang (SnowballSH)
go
info depth 1 seldepth 1 nodes 24 time 17 score cp 37 pv d2d4
info string thread 0 nodes 83
info depth 2 seldepth 2 nodes 83 time 54 score cp 29 pv d2d4 g8f6
info string thread 0 nodes 184
info depth 3 seldepth 3 nodes 184 time 93 score cp 35 pv d2d4 g8f6 g1f3
Bus error at address 0x16d328000
Panicked during a panic. Aborting.
[1]    562 abort      zig-out/bin/Avalanche
SnowballSH commented 5 months ago

Hey, I have encountered the same issue when trying to migrate zig to self hosted stages of zig. I have consulted zig experts and it seems like it's simply an issue of compatibility and is difficult to fix or debug without a full rewrite. In the meanwhile, I will resort to compiling with zig 0.10.1 for now. Thanks for the PR, I will take a took when I get free time.

SnowballSH commented 5 months ago

Btw, the project is mostly paused now and I plan to do a rewrite when zig 1.0 comes out, as current versions of zig are way too unstable and subject to significant language changes. But still thanks for trying to make Avalanche compile in recent versions of zig... I will try again to look for solutions with some Zig people I talked with.

SnowballSH commented 5 months ago

I just remembered that I was able to make it run to around depth 9 in debug mode, but it takes way too much time compared to stage1 compile. Then after that I hit the same bus error.

giann commented 5 months ago

I guess the slow down was due to the debug mode. Hard to help on this error since I'm more than unfamiliar with the implementation. I'm not sure a full rewrite is necessary though.

Unrelated question: did you come up with the BitBoard idea? What a neat trick :)

SnowballSH commented 5 months ago

Not like I know my code any better as I haven't read my move generation code for so long 😅 I didn't come up with the bit board idea, as it has been commonly used for a long time. See https://www.chessprogramming.org/Bitboards it seems like it has been invented since the late 20th century. Although I believe I was one of the first to implement it in Zig, lol.

SnowballSH commented 5 months ago

I wanted to do a rewrite simply because I learned a lot about practices in Zig and chess programming since I started this project, and there are so many things I could improve everywhere that would be difficult to partially rewrite.