emdio / kitteneitor

A chess engine derived from secondchess
4 stars 3 forks source link

Load position of Lev Alburt #9

Open kimnamcham opened 9 years ago

kimnamcham commented 9 years ago

I modified function test1 and use command "on" to force move to computer auto move chess from position of Lev Alburt, here is 1 position from the Lev Alburt: int piece_test[64]={ EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, PAWN, EMPTY, EMPTY, KING, PAWN, EMPTY, PAWN, PAWN, EMPTY, EMPTY, EMPTY, PAWN, KNIGHT, EMPTY, EMPTY, EMPTY, EMPTY, ROOK, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, PAWN, EMPTY, KNIGHT, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, PAWN, PAWN, EMPTY, EMPTY, EMPTY, PAWN, PAWN, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, ROOK, KING, EMPTY }; int color_test[64]={ EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, BLACK, EMPTY, EMPTY, BLACK, BLACK, EMPTY, BLACK, BLACK, EMPTY, EMPTY, EMPTY, BLACK, BLACK, EMPTY, EMPTY, EMPTY, EMPTY, BLACK, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, WHITE, EMPTY, WHITE, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, WHITE, WHITE, EMPTY, EMPTY, EMPTY, WHITE, WHITE, EMPTY, EMPTY, EMPTY, EMPTY, EMPTY, WHITE, WHITE, EMPTY }; max depth =6, it's running normal but cannot end game. If i set max depth higher, sometime it's crash. Someone can't help this problem ?

kimnamcham commented 9 years ago

Here is image of postion: http://www.chessvideos.tv/bimg/45sh39g3yo6c4.png

emdio commented 9 years ago

Thanks for the info.

I've tested the position on my computer up to ply 10 and haven't got any crash though. I'll keep testing the next days.

kimnamcham commented 9 years ago

Sometime it will be crashed, and other problems is game cannot end, because some moves is repeated

kimnamcham commented 9 years ago

whenever i set max depth >6, it always crash, breakpoint stop is here: rep movsd ;N - move all of our dwords log: msvcr110d.dll!memcpy(unsigned char * dst, unsigned char * src, unsigned long count) Line 524 Unknown I think the size of move list small, so i change the size of moveBuf from 6000 to 10000 on search method in search.cpp but it's cannot solve the problem.

emdio commented 9 years ago

I've tried several times, up to ply 10 on this position, and Kitt doesn't crash :/

This is Kitt's output up to ply 9: 1 54 0 63 f1d1 2 27 0 484 h2h4 e6e5 3 28 0 5152 f1f2 f6d5 c3e4 4 15 2 21161 f1c1 e7f8 c1d1 e6e5 5 8 12 139704 f1f2 c5c8 f2e2 c8d8 e2e1 6 19 33 361062 f1f6 c5c3 f6f7 e7f7 b2c3 e6e5 g1f2 7 3 493 3805612 f1d1 c5c8 h2h4 c8c4 g2g3 f6e4 c3e4 8 9 1557 12035443 f1f6 c5c3 f6f7 e7f7 b2c3 e6e5 g1f2 e5e4 f2e3 9 9 8114 61954063 f1f6 c5c3 f6f7 e7f7 b2c3 b7b5 g1f2 e6e5 f2e3 f7e6

Can you paste your output? Maybe we can find a difference in the nodes counted.

How are you compiling Kitt?

moveBuff original value is 200; the only way to overflow this number (other than bugs) is by reaching a position with more than 200 possible moves!

kimnamcham commented 9 years ago

I have some modify your engine to complie in visual studio, and i change .c to cpp here it's your project after modify: http://upfile.vn/nsGgKQXm_Qjm/kitteneitor-master-rar.html

emdio commented 9 years ago

Hmmm, that'll make the bug harder to find. Asuming the issue is in the search code, I've compared both search files, and the only significant difference I find is here: printf (" %d %2d %4d %8" PRId64, i, score, int_time, nodes); Your code is: printf (" %d %2d %4d %8", i, score, int_time, nodes);

removing the PRId64 part. Sincerely I just can't remember the reason of that part of code, but it seems to be related to printing 64 bits integers. http://stackoverflow.com/questions/6299083/cross-platform-printing-of-64-bit-integers-with-printf

Other than that, I just have no idea what the isue can be, and my knowledge on windows programming is null.

EDIT: I forgfot to mention that I can't compile your code on my linux machine, neither by gcc or g++

kimnamcham commented 9 years ago

Because compling in visual has some error, so i must change to can run engine. I will try to get solution for my problem by myself . Thanks you very much for help me again :)

emdio commented 9 years ago

Sorry not be of many help here.

My only suggestion is (due to the fact that this bug doesn't seem to be in original code) is to carefuly compare all the modifications you had to do on your code in order to make it work under windows.

kimnamcham commented 9 years ago

I have created a new project and port your engine in visual again. And it's can run with depth = 9 :0 . But i see time of searching position 's very slow. I change the function getMs after search google how to port gettimeofday from linux to window. But my time output is different than you . output

kimnamcham commented 9 years ago

When i set depth = 8, it run normaly but still have crash. output1

emdio commented 9 years ago

I reproduced the las position and got not crash up to ply 10.

I've noted that you don't print out the nodes counting info. I encourage to do it, because a disagreement in this number has once in a while served me as a warning for existent but not declaring bugs.

emdio commented 9 years ago

Ok, I just noticed it; the castling rights for this position should be set to "0", for evident reasons. Not sure whether this is the reason of the misbehaviour, but it can be for sure an issue in other positions.

kimnamcham commented 9 years ago

I think print out the nodes counting info is not problem, because it break in this line on search.cpp: memcpy(pline->argmove + 1, line.argmove, line.cmove * sizeof(MOVE)); You can see the callstack at here: output

emdio commented 9 years ago

I did not explain myself properly; as a general rule, it's a good idea to print out the node counting, because it can eventually help to find out bugs. For example, if different compilations of your code give different nodes counting for the same position, then for sure there is a bug in your code, even if it doesn't crash the engine.

kimnamcham commented 9 years ago

I just run the exe program of engine on windows, setboard by fen and run normaly. But version c++ on visual it's crash, And i find the problem is the varibles pline and line is out of memory so it make memcpy is broken.