Beginner AB move ordering question

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
Desperado
Posts: 879
Joined: Mon Dec 15, 2008 11:45 am

Re: Beginner AB move ordering question

Post by Desperado »

i thought of the _qs_ issue also, and of course there can be hundreds of
different reasons for the strange results he gets.

But on the _qs_ thing, my thought is that even if it would be missing,
the search would be minimizing down the value around a pawnValue, but cetainly not a piece value or more.

i think we can only wait what he will report.

Michael
User avatar
stevemulligan
Posts: 117
Joined: Wed Jul 20, 2011 2:54 pm
Location: Ottawa, Canada

Re: Beginner AB move ordering question

Post by stevemulligan »

The QS is disabled and I don't have any hashing yet. Hopefully I will have time today to try out the suggestions.
User avatar
Desperado
Posts: 879
Joined: Mon Dec 15, 2008 11:45 am

Re: Beginner AB move ordering question

Post by Desperado »

I fear there will be broken several things.

- As Sven pointed out, make sure the technical stuff works proper.
- As HGM pointed out, the scores should _not_ differ even if they are wrong
- As i guess there are some hidden sign problems (evaluation,search)

- All together, i am not suprised you are searching since days not for
one but for several bugs.

STEP 1:
======

maybe the most important thing Sven mentioned. Technical functions
_must_ work proper.

below you find a collection of fenStrings and its corresponding
nodecounts up to ply 6. Try to verify them.

Code: Select all

static const char *perftPosition[maxPos] =
{
 "4k3/8/8/8/8/8/8/4K2R w K - 0 1",
 "4k3/8/8/8/8/8/8/R3K3 w Q - 0 1",
 "4k2r/8/8/8/8/8/8/4K3 w k - 0 1",
 "r3k3/8/8/8/8/8/8/4K3 w q - 0 1",
 "4k3/8/8/8/8/8/8/R3K2R w KQ - 0 1", //5
 "r3k2r/8/8/8/8/8/8/4K3 w kq - 0 1",
 "8/8/8/8/8/8/6k1/4K2R w K - 0 1",
 "8/8/8/8/8/8/1k6/R3K3 w Q - 0 1",
 "4k2r/6K1/8/8/8/8/8/8 w k - 0 1",
 "r3k3/1K6/8/8/8/8/8/8 w q - 0 1", //10
 "r3k2r/8/8/8/8/8/8/R3K2R w KQkq - 0 1",
 "r3k2r/8/8/8/8/8/8/1R2K2R w Kkq - 0 1",
 "r3k2r/8/8/8/8/8/8/2R1K2R w Kkq - 0 1",
 "r3k2r/8/8/8/8/8/8/R3K1R1 w Qkq - 0 1",
 "1r2k2r/8/8/8/8/8/8/R3K2R w KQk - 0 1", //15
 "2r1k2r/8/8/8/8/8/8/R3K2R w KQk - 0 1",
 "r3k1r1/8/8/8/8/8/8/R3K2R w KQq - 0 1",
 "4k3/8/8/8/8/8/8/4K2R b K - 0 1",
 "4k3/8/8/8/8/8/8/R3K3 b Q - 0 1",
 "4k2r/8/8/8/8/8/8/4K3 b k - 0 1", //20
 "r3k3/8/8/8/8/8/8/4K3 b q - 0 1",
 "4k3/8/8/8/8/8/8/R3K2R b KQ - 0 1",
 "r3k2r/8/8/8/8/8/8/4K3 b kq - 0 1",
 "8/8/8/8/8/8/6k1/4K2R b K - 0 1",
 "8/8/8/8/8/8/1k6/R3K3 b Q - 0 1", //25
 "4k2r/6K1/8/8/8/8/8/8 b k - 0 1",
 "r3k3/1K6/8/8/8/8/8/8 b q - 0 1",
 "r3k2r/8/8/8/8/8/8/R3K2R b KQkq - 0 1",
 "r3k2r/8/8/8/8/8/8/1R2K2R b Kkq - 0 1",
 "r3k2r/8/8/8/8/8/8/2R1K2R b Kkq - 0 1", //30
 "r3k2r/8/8/8/8/8/8/R3K1R1 b Qkq - 0 1",
 "1r2k2r/8/8/8/8/8/8/R3K2R b KQk - 0 1",
 "2r1k2r/8/8/8/8/8/8/R3K2R b KQk - 0 1",
 "r3k1r1/8/8/8/8/8/8/R3K2R b KQq - 0 1",
 "8/1n4N1/2k5/8/8/5K2/1N4n1/8 w - - 0 1", //35
 "8/1k6/8/5N2/8/4n3/8/2K5 w - - 0 1",
 "8/8/4k3/3Nn3/3nN3/4K3/8/8 w - - 0 1",
 "K7/8/2n5/1n6/8/8/8/k6N w - - 0 1",
 "k7/8/2N5/1N6/8/8/8/K6n w - - 0 1",
 "8/1n4N1/2k5/8/8/5K2/1N4n1/8 b - - 0 1", //40
 "8/1k6/8/5N2/8/4n3/8/2K5 b - - 0 1",
 "8/8/3K4/3Nn3/3nN3/4k3/8/8 b - - 0 1",
 "K7/8/2n5/1n6/8/8/8/k6N b - - 0 1",
 "k7/8/2N5/1N6/8/8/8/K6n b - - 0 1",

 "B6b/8/8/8/2K5/4k3/8/b6B w - - 0 1", //45
 "8/8/1B6/7b/7k/8/2B1b3/7K w - - 0 1",
 "k7/B7/1B6/1B6/8/8/8/K6b w - - 0 1",
 "K7/b7/1b6/1b6/8/8/8/k6B w - - 0 1",
 "B6b/8/8/8/2K5/5k2/8/b6B b - - 0 1",
 "8/8/1B6/7b/7k/8/2B1b3/7K b - - 0 1", //50
 "k7/B7/1B6/1B6/8/8/8/K6b b - - 0 1",
 "K7/b7/1b6/1b6/8/8/8/k6B b - - 0 1",
 "7k/RR6/8/8/8/8/rr6/7K w - - 0 1",
 "R6r/8/8/2K5/5k2/8/8/r6R w - - 0 1",
 "7k/RR6/8/8/8/8/rr6/7K b - - 0 1", //55
 "R6r/8/8/2K5/5k2/8/8/r6R b - - 0 1",

 "6kq/8/8/8/8/8/8/7K w - - 0 1",
 "6KQ/8/8/8/8/8/8/7k b - - 0 1",
 "K7/8/8/3Q4/4q3/8/8/7k w - - 0 1",
 "6qk/8/8/8/8/8/8/7K b - - 0 1", //60
 "6KQ/8/8/8/8/8/8/7k b - - 0 1",
 "K7/8/8/3Q4/4q3/8/8/7k b - - 0 1",

 "8/8/8/8/8/K7/P7/k7 w - - 0 1",
 "8/8/8/8/8/7K/7P/7k w - - 0 1",
 "K7/p7/k7/8/8/8/8/8 w - - 0 1", //65
 "7K/7p/7k/8/8/8/8/8 w - - 0 1",
 "8/2k1p3/3pP3/3P2K1/8/8/8/8 w - - 0 1",
 "8/8/8/8/8/K7/P7/k7 b - - 0 1",
 "8/8/8/8/8/7K/7P/7k b - - 0 1",
 "K7/p7/k7/8/8/8/8/8 b - - 0 1", //70
 "7K/7p/7k/8/8/8/8/8 b - - 0 1",
 "8/2k1p3/3pP3/3P2K1/8/8/8/8 b - - 0 1",
 "8/8/8/8/8/4k3/4P3/4K3 w - - 0 1",
 "4k3/4p3/4K3/8/8/8/8/8 b - - 0 1",
 "8/8/7k/7p/7P/7K/8/8 w - - 0 1", //75
 "8/8/k7/p7/P7/K7/8/8 w - - 0 1",
 "8/8/3k4/3p4/3P4/3K4/8/8 w - - 0 1",
 "8/3k4/3p4/8/3P4/3K4/8/8 w - - 0 1",
 "8/8/3k4/3p4/8/3P4/3K4/8 w - - 0 1",
 "k7/8/3p4/8/3P4/8/8/7K w - - 0 1", //80
 "8/8/7k/7p/7P/7K/8/8 b - - 0 1",
 "8/8/k7/p7/P7/K7/8/8 b - - 0 1",
 "8/8/3k4/3p4/3P4/3K4/8/8 b - - 0 1",
 "8/3k4/3p4/8/3P4/3K4/8/8 b - - 0 1",
 "8/8/3k4/3p4/8/3P4/3K4/8 b - - 0 1", //85
 "k7/8/3p4/8/3P4/8/8/7K b - - 0 1",

 "7k/3p4/8/8/3P4/8/8/K7 w - - 0 1",
 "7k/8/8/3p4/8/8/3P4/K7 w - - 0 1",
 "k7/8/8/7p/6P1/8/8/K7 w - - 0 1",
 "k7/8/7p/8/8/6P1/8/K7 w - - 0 1", //90
 "k7/8/8/6p1/7P/8/8/K7 w - - 0 1",
 "k7/8/6p1/8/8/7P/8/K7 w - - 0 1",
 "k7/8/8/3p4/4p3/8/8/7K w - - 0 1",
 "k7/8/3p4/8/8/4P3/8/7K w - - 0 1",
 "7k/3p4/8/8/3P4/8/8/K7 b - - 0 1", //95
 "7k/8/8/3p4/8/8/3P4/K7 b - - 0 1",
 "k7/8/8/7p/6P1/8/8/K7 b - - 0 1",
 "k7/8/7p/8/8/6P1/8/K7 b - - 0 1",
 "k7/8/8/6p1/7P/8/8/K7 b - - 0 1",
 "k7/8/6p1/8/8/7P/8/K7 b - - 0 1", //100
 "k7/8/8/3p4/4p3/8/8/7K b - - 0 1",
 "k7/8/3p4/8/8/4P3/8/7K b - - 0 1",
 "7k/8/8/p7/1P6/8/8/7K w - - 0 1 ",
 "7k/8/p7/8/8/1P6/8/7K w - - 0 1",
 "7k/8/8/1p6/P7/8/8/7K w - - 0 1", //105
 "7k/8/1p6/8/8/P7/8/7K w - - 0 1",
 "k7/7p/8/8/8/8/6P1/K7 w - - 0 1",
 "k7/6p1/8/8/8/8/7P/K7 w - - 0 1 ",
 "3k4/3pp3/8/8/8/8/3PP3/3K4 w - - 0 1",
 "7k/8/8/p7/1P6/8/8/7K b - - 0 1", //110
 "7k/8/p7/8/8/1P6/8/7K b - - 0 1",
 "7k/8/8/1p6/P7/8/8/7K b - - 0 1",
 "7k/8/1p6/8/8/P7/8/7K b - - 0 1",
 "k7/7p/8/8/8/8/6P1/K7 b - - 0 1",
 "k7/6p1/8/8/8/8/7P/K7 b - - 0 1", //115
 "3k4/3pp3/8/8/8/8/3PP3/3K4 b - - 0 1",
 "8/Pk6/8/8/8/8/6Kp/8 w - - 0 1",
 "n1n5/1Pk5/8/8/8/8/5Kp1/5N1N w - - 0 1",
 "8/PPPk4/8/8/8/8/4Kppp/8 w - - 0 1",
 "n1n5/PPPk4/8/8/8/8/4Kppp/5N1N w - - 0 1", //120
 "8/Pk6/8/8/8/8/6Kp/8 b - - 0 1",
 "n1n5/1Pk5/8/8/8/8/5Kp1/5N1N b - - 0 1",
 "8/PPPk4/8/8/8/8/4Kppp/8 b - - 0 1",
 "n1n5/PPPk4/8/8/8/8/4Kppp/5N1N b - - 0 1",
 "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",//125
 "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1"
};

static const ui64_t perftNumber[maxPos][6] =
{
 15,66,1197,7059,133987,764643,
 16,71,1287,7626,145232,846648,
 5,75,459,8290,47635,899442,
 5,80,493,8897,52710,1001523,
 26,112,3189,17945,532933,2788982, //5
 5,130,782,22180,118882,3517770,
 12,38,564,2219,37735,185867,
 15,65,1018,4573,80619,413018,
 3,32,134,2073,10485,179869,
 4,49,243,3991,20780,367724, //10
 26,568,13744,314346,7594526,179862938,
 25,567,14095,328965,8153719,195629489,
 25,548,13502,312835,7736373,184411439,
 25,547,13579,316214,7878456,189224276,
 26,583,14252,334705,8198901,198328929, //15
 25,560,13592,317324,7710115,185959088,
 25,560,13607,320792,7848606,190755813,
 5,75,459,8290,47635,899442,
 5,80,493,8897,52710,1001523, 
 15,66,1197,7059,133987,764643, //20
 16,71,1287,7626,145232,846648,
 5,130,782,22180,118882,3517770,
 26,112,3189,17945,532933,2788982,
 3,32,134,2073,10485,179869, 
 4,49,243,3991,20780,367724, //25
 12,38,564,2219,37735,185867,
 15,65,1018,4573,80619,413018,
 26,568,13744,314346,7594526,179862938,
 26,583,14252,334705,8198901,198328929,
 25,560,13592,317324,7710115,185959088, //30
 25,560,13607,320792,7848606,190755813,
 25,567,14095,328965,8153719,195629489,
 25,548,13502,312835,7736373,184411439,
 25,547,13579,316214,7878456,189224276,
 14,195,2760,38675,570726,8107539, //35
 11,156,1636,20534,223507,2594412,
 19,289,4442,73584,1198299,19870403,
 3,51,345,5301,38348,588695,
 17,54,835,5910,92250,688780, 
 15,193,2816,40039,582642,8503277, //40
 16,180,2290,24640,288141,3147566,
 4,68,1118,16199,281190,4405103,
 17,54,835,5910,92250,688780,
 3,51,345,5301,38348,588695,
 17,278,4607,76778,1320507,22823890, //45
 21,316,5744,93338,1713368,28861171,
 21,144,3242,32955,787524,7881673,
 7,143,1416,31787,310862,7382896,
 6,106,1829,31151,530585,9250746,
 17,309,5133,93603,1591064,29027891, //50
 7,143,1416,31787,310862,7382896,
 21,144,3242,32955,787524,7881673,
 19,275,5300,104342,2161211,44956585,
 36,1027,29215,771461,20506480,525169084,
 19,275,5300,104342,2161211,44956585, //55
 36,1027,29227,771368,20521342,524966748,
 2,36,143,3637,14893,391507,
 2,36,143,3637,14893,391507,
 6,35,495,8349,166741,3370175,
 22,43,1015,4167,105749,419369, //60
 2,36,143,3637,14893,391507,
 6,35,495,8349,166741,3370175,
 3,7,43,199,1347,6249,
 3,7,43,199,1347,6249, 
 1,3,12,80,342,2343, //65
 1,3,12,80,342,2343,
 7,35,210,1091,7028,34834,
 1,3,12,80,342,2343,
 1,3,12,80,342,2343,
 3,7,43,199,1347,6249, //70
 3,7,43,199,1347,6249,
 5,35,182,1091,5408,34822,
 2,8,44,282,1814,11848,
 2,8,44,282,1814,11848,
 3,9,57,360,1969,10724, //75
 3,9,57,360,1969,10724,
 5,25,180,1294,8296,53138,
 8,61,483,3213,23599,157093,
 8,61,411,3213,21637,158065,
 4,15,90,534,3450,20960, //80
 3,9,57,360,1969,10724,
 3,9,57,360,1969,10724,
 5,25,180,1294,8296,53138,
 8,61,411,3213,21637,158065,
 8,61,483,3213,23599,157093, //85
 4,15,89,537,3309,21104,
 4,19,117,720,4661,32191,
 5,19,116,716,4786,30980,
 5,22,139,877,6112,41874,
 4,16,101,637,4354,29679, //90
 5,22,139,877,6112,41874,
 4,16,101,637,4354,29679,
 3,15,84,573,3013,22886,
 4,16,101,637,4271,28662,
 5,19,117,720,5014,32167, //95
 4,19,117,712,4658,30749,
 5,22,139,877,6112,41874,
 4,16,101,637,4354,29679,
 5,22,139,877,6112,41874,
 4,16,101,637,4354,29679, //100
 5,15,102,569,4337,22579,
 4,16,101,637,4271,28662,
 5,22,139,877,6112,41874,
 4,16,101,637,4354,29679,
 5,22,139,877,6112,41874, //105
 4,16,101,637,4354,29679,
 5,25,161,1035,7574,55338,
 5,25,161,1035,7574,55338,
 7,49,378,2902,24122,199002,
 5,22,139,877,6112,41874, //110
 4,16,101,637,4354,29679,
 5,22,139,877,6112,41874,
 4,16,101,637,4354,29679,
 5,25,161,1035,7574,55338,
 5,25,161,1035,7574,55338, //115
 7,49,378,2902,24122,199002,
 11,97,887,8048,90606,1030499,
 24,421,7421,124608,2193768,37665329,
 18,270,4699,79355,1533145,28859283,
 24,496,9483,182838,3605103,71179139, //120
 11,97,887,8048,90606,1030499,
 24,421,7421,124608,2193768,37665329,
 18,270,4699,79355,1533145,28859283,
 24,496,9483,182838,3605103,71179139,
 20,400,8902,197281,4865609,119060324, //125
 48,2039,97862,4085603,193690690,8031647685
};
Michael
User avatar
stevemulligan
Posts: 117
Joined: Wed Jul 20, 2011 2:54 pm
Location: Ottawa, Canada

Re: Beginner AB move ordering question

Post by stevemulligan »

Hi Michael

The set of fenStrings helped me find an EP bug (test #69 found 4 root moves instead of 3). After fixing that everything passes up to 5 ply. Testing up to 6 will probably take me a couple days but it's running.

Using the 2 ply open window search you suggested was very informative but I didn't see any errors there. The results all made sense for a 2 ply search.

Just a couple minutes ago I found the bug. I search for mate outside of my board eval function and return early. Very messy, and it was the cause of this problem. I was returning a magic number that had the wrong sign.

Thanks again to everyone who replied for the tips & techniques. It will really speed things up for me the next time I get stuck, and my engine is a lot more stable after only asking 1 question here :) I have some more newbie questions about board evaluation but I will ask in a new thread after I get my magic number nonsense cleaned up.
User avatar
stevemulligan
Posts: 117
Joined: Wed Jul 20, 2011 2:54 pm
Location: Ottawa, Canada

Re: Beginner AB move ordering question

Post by stevemulligan »

Is there a list of "mate in x" puzzles in fen format? I'm trying random puzzles from http://www.yacpdb.org right now.
User avatar
stevemulligan
Posts: 117
Joined: Wed Jul 20, 2011 2:54 pm
Location: Ottawa, Canada

Re: Beginner AB move ordering question

Post by stevemulligan »

There is another thread titled WAC test that explained it all. I found some epd tests on the chess programming wiki.

eg.

http://www.bergbomconsulting.se/chess/epdfiles/wac.epd


I guess the tricky part is knowing when it's a bug or only because my engine is isn't searching deep enough.