Simple FEN positions to test code?

Discussion of chess software programming and technical issues.

Moderator: Ras

mike_bike_kite
Posts: 98
Joined: Tue Jul 26, 2011 12:18 am
Location: London

Simple FEN positions to test code?

Post by mike_bike_kite »

I'm looking for some simple FEN positions with a resulting set of move sequences that should be tried and the score each position should return - ie showing moves + score + cut. Ideally I want to test alpha beta pruning and stand pat positions.

I've tried altering my code, I've tried expanding out the psuedo code I find on the web and in desperation I've also tried random changes. While I can get the search tree to behave for certain situations I'll always find something that just kills everything. I'm hoping if I have a few test positions then I could isolate problems quicker.

I'll admit my mind has turned to goo since trying to unravel all this stuff.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Simple FEN positions to test code?

Post by Sven »

What exactly is going wrong? Can you give one example?

It is almost impossible to have some "generic" test positions suitable for any kind of possible problem in a search implementation, so I think you must be more concrete in describing the problem(s).

Quite recently I wrote a very brief summary of alpha-beta, did you notice it?

Sven
mike_bike_kite
Posts: 98
Joined: Tue Jul 26, 2011 12:18 am
Location: London

Re: Simple FEN positions to test code?

Post by mike_bike_kite »

Sven Schüle wrote:What exactly is going wrong? Can you give one example?

It is almost impossible to have some "generic" test positions suitable for any kind of possible problem in a search implementation, so I think you must be more concrete in describing the problem(s).
I could give you thousands of examples but I'll limit myself to one. I came unstuck when I tried to do stand pat. Oddly everything up to this point had been quite straightforward even if my existing code didn't do alpha beta very effectively. I figured I'd rewrite that part while implementing stand pat. In the past month I've rewritten the code roughly 4 times and I'll be the first to admit I'm now loosing it.

Code: Select all

++++++++
+++++k++
+++b+p++
++++++p+
++++N+++
++++++++
+++++K++
++++++++   white to move

FEN = 8/5k2/3b1p2/6p1/4N3/8/5K2/ w

New Search to depth 2.0 with White to move
level) alpha beta "move sequence" => score
1) -2000000      120 Ne4xd6 Kf7-e7 => 120 set beta
1) -2000000      120 Ne4xd6 Kf7-g7 => 120 not as good as 120
1) -2000000      120 Ne4xd6 Kf7-f8 => 120 not as good as 120
1) -2000000      120 Ne4xd6 Kf7-g8 => 120 not as good as 120
1) -2000000      116 Ne4xd6 Kf7-g6 => 116 set beta
1) -2000000      116 Ne4xd6 Kf7-e6 => 120 not as good as 116
0)      116  2000000 Ne4xd6 => 116 set alpha
----------
1)      116     -829 Ne4xf6 Kf7xf6 => -829 set beta CUT
0)      116  2000000 Ne4xf6 => -829 not as good as 116
----------
1)      116     -829 Ne4xg5 Pf6xg5 => -829 set beta CUT
0)      116  2000000 Ne4xg5 => -829 not as good as 116
----------
2)      116  2000000 Kf2-f3 Pg5-g4 Kf3xg4 => -261 not as good as 116
1)      116      116 Kf2-f3 Pg5-g4 => 116 set beta
2)      116      116 Kf2-f3 Bd6-e5 pat => -367 not as good as 116
3)      116     -275 Kf2-f3 Bd6-e5 Ne4xf6 pat => -275 set beta CUT
2)      116      116 Kf2-f3 Bd6-e5 Ne4xf6 => -275 not as good as 116
3)      116     -824 Kf2-f3 Bd6-e5 Ne4xg5 Pf6xg5 => -824 set beta CUT
2)      116      116 Kf2-f3 Bd6-e5 Ne4xg5 => -824 not as good as 116
1)      116      116 Kf2-f3 Bd6-e5 => 116 not as good as 116
2)      116      116 Kf2-f3 Bd6-f4 pat => -367 not as good as 116
3)      116     -273 Kf2-f3 Bd6-f4 Ne4xf6 pat => -273 set beta CUT
2)      116      116 Kf2-f3 Bd6-f4 Ne4xf6 => -273 not as good as 116
3)      116     -818 Kf2-f3 Bd6-f4 Ne4xg5 Pf6xg5 => -818 set beta CUT
2)      116      116 Kf2-f3 Bd6-f4 Ne4xg5 => -818 not as good as 116
1)      116      116 Kf2-f3 Bd6-f4 => 116 not as good as 116
2)      116      116 Kf2-f3 Bd6-c5 pat => -369 not as good as 116
2)      129      116 Kf2-f3 Bd6-c5 Ne4xc5 => 129 set alpha CUT
1)      116      116 Kf2-f3 Bd6-c5 => 129 not as good as 116
2)      116      116 Kf2-f3 Pf6-f5 pat => -413 not as good as 116
2)      116      116 Kf2-f3 Pf6-f5 Ne4xd6 => 89 not as good as 116
2)      116      116 Kf2-f3 Pf6-f5 Ne4xg5 => -325 not as good as 116
1)      116      116 Kf2-f3 Pf6-f5 => 116 not as good as 116
2)      116      116 Kf2-f3 Bd6-c7 pat => -363 not as good as 116
3)      116     -269 Kf2-f3 Bd6-c7 Ne4xf6 pat => -269 set beta CUT
2)      116      116 Kf2-f3 Bd6-c7 Ne4xf6 => -269 not as good as 116
3)      116     -814 Kf2-f3 Bd6-c7 Ne4xg5 Pf6xg5 => -814 set beta CUT
2)      116      116 Kf2-f3 Bd6-c7 Ne4xg5 => -814 not as good as 116
1)      116      116 Kf2-f3 Bd6-c7 => 116 not as good as 116
2)      116      116 Kf2-f3 Bd6-e7 pat => -357 not as good as 116
3)      116     -265 Kf2-f3 Bd6-e7 Ne4xf6 pat => -265 set beta CUT
2)      116      116 Kf2-f3 Bd6-e7 Ne4xf6 => -265 not as good as 116
3)      116     -810 Kf2-f3 Bd6-e7 Ne4xg5 Pf6xg5 => -810 set beta CUT
2)      116      116 Kf2-f3 Bd6-e7 Ne4xg5 => -810 not as good as 116
1)      116      116 Kf2-f3 Bd6-e7 => 116 not as good as 116
2)      116      116 Kf2-f3 Bd6-g3 pat => -353 not as good as 116
2)      139      116 Kf2-f3 Bd6-g3 Ne4xg3 => 139 set alpha CUT
1)      116      116 Kf2-f3 Bd6-g3 => 139 not as good as 116
2)      116      116 Kf2-f3 Bd6-b4 pat => -365 not as good as 116
3)      116     -271 Kf2-f3 Bd6-b4 Ne4xf6 pat => -271 set beta CUT
2)      116      116 Kf2-f3 Bd6-b4 Ne4xf6 => -271 not as good as 116
3)      116     -816 Kf2-f3 Bd6-b4 Ne4xg5 Pf6xg5 => -816 set beta CUT
2)      116      116 Kf2-f3 Bd6-b4 Ne4xg5 => -816 not as good as 116
1)      116      116 Kf2-f3 Bd6-b4 => 116 not as good as 116
2)      116      116 Kf2-f3 Kf7-e7 pat => -361 not as good as 116
3)      116      116 Kf2-f3 Kf7-e7 Ne4xd6 pat => 129 not as good as 116
3)      116     -429 Kf2-f3 Kf7-e7 Ne4xd6 Ke7xd6 => -429 set beta CUT
2)      116      116 Kf2-f3 Kf7-e7 Ne4xd6 => -429 not as good as 116
3)      116     -271 Kf2-f3 Kf7-e7 Ne4xf6 pat => -271 set beta CUT
2)      116      116 Kf2-f3 Kf7-e7 Ne4xf6 => -271 not as good as 116
3)      116     -272 Kf2-f3 Kf7-e7 Ne4xg5 pat => -272 set beta CUT
2)      116      116 Kf2-f3 Kf7-e7 Ne4xg5 => -272 not as good as 116
1)      116      116 Kf2-f3 Kf7-e7 => 116 not as good as 116
2)      116      116 Kf2-f3 Kf7-g7 pat => -365 not as good as 116
2)      129      116 Kf2-f3 Kf7-g7 Ne4xd6 => 129 set alpha CUT
1)      116      116 Kf2-f3 Kf7-g7 => 129 not as good as 116
2)      116      116 Kf2-f3 Kf7-f8 pat => -363 not as good as 116
2)      129      116 Kf2-f3 Kf7-f8 Ne4xd6 => 129 set alpha CUT
1)      116      116 Kf2-f3 Kf7-f8 => 129 not as good as 116
2)      116      116 Kf2-f3 Kf7-e8 pat => -365 not as good as 116
2)      133      116 Kf2-f3 Kf7-e8 Ne4xd6 => 133 set alpha CUT
1)      116      116 Kf2-f3 Kf7-e8 => 133 not as good as 116
2)      116      116 Kf2-f3 Kf7-g8 pat => -365 not as good as 116
2)      129      116 Kf2-f3 Kf7-g8 Ne4xd6 => 129 set alpha CUT
1)      116      116 Kf2-f3 Kf7-g8 => 129 not as good as 116
2)      116      116 Kf2-f3 Kf7-g6 pat => -369 not as good as 116
2)      125      116 Kf2-f3 Kf7-g6 Ne4xd6 => 125 set alpha CUT
1)      116      116 Kf2-f3 Kf7-g6 => 125 not as good as 116
2)      116      116 Kf2-f3 Kf7-e6 pat => -365 not as good as 116
3)      116      116 Kf2-f3 Kf7-e6 Ne4xd6 pat => 129 not as good as 116
3)      116     -429 Kf2-f3 Kf7-e6 Ne4xd6 Ke6xd6 => -429 set beta CUT
2)      116      116 Kf2-f3 Kf7-e6 Ne4xd6 => -429 not as good as 116
3)      116     -275 Kf2-f3 Kf7-e6 Ne4xf6 pat => -275 set beta CUT
2)      116      116 Kf2-f3 Kf7-e6 Ne4xf6 => -275 not as good as 116
3)      116     -820 Kf2-f3 Kf7-e6 Ne4xg5 Pf6xg5 => -820 set beta CUT
2)      116      116 Kf2-f3 Kf7-e6 Ne4xg5 => -820 not as good as 116
1)      116      116 Kf2-f3 Kf7-e6 => 116 not as good as 116
2)      116      116 Kf2-f3 Bd6-f8 pat => -339 not as good as 116
3)      116     -245 Kf2-f3 Bd6-f8 Ne4xf6 pat => -245 set beta CUT
2)      116      116 Kf2-f3 Bd6-f8 Ne4xf6 => -245 not as good as 116
3)      116     -790 Kf2-f3 Bd6-f8 Ne4xg5 Pf6xg5 => -790 set beta CUT
2)      116      116 Kf2-f3 Bd6-f8 Ne4xg5 => -790 not as good as 116
1)      116      116 Kf2-f3 Bd6-f8 => 116 not as good as 116
2)      116      116 Kf2-f3 Bd6-a3 pat => -339 not as good as 116
3)      116     -245 Kf2-f3 Bd6-a3 Ne4xf6 pat => -245 set beta CUT
2)      116      116 Kf2-f3 Bd6-a3 Ne4xf6 => -245 not as good as 116
3)      116     -790 Kf2-f3 Bd6-a3 Ne4xg5 Pf6xg5 => -790 set beta CUT
2)      116      116 Kf2-f3 Bd6-a3 Ne4xg5 => -790 not as good as 116
1)      116      116 Kf2-f3 Bd6-a3 => 116 not as good as 116
2)      116      116 Kf2-f3 Bd6-b8 pat => -339 not as good as 116
3)      116     -245 Kf2-f3 Bd6-b8 Ne4xf6 pat => -245 set beta CUT
2)      116      116 Kf2-f3 Bd6-b8 Ne4xf6 => -245 not as good as 116
3)      116     -790 Kf2-f3 Bd6-b8 Ne4xg5 Pf6xg5 => -790 set beta CUT
2)      116      116 Kf2-f3 Bd6-b8 Ne4xg5 => -790 not as good as 116
1)      116      116 Kf2-f3 Bd6-b8 => 116 not as good as 116
2)      116      116 Kf2-f3 Bd6-h2 pat => -343 not as good as 116
3)      116     -249 Kf2-f3 Bd6-h2 Ne4xf6 pat => -249 set beta CUT
2)      116      116 Kf2-f3 Bd6-h2 Ne4xf6 => -249 not as good as 116
3)      116     -794 Kf2-f3 Bd6-h2 Ne4xg5 Pf6xg5 => -794 set beta CUT
2)      116      116 Kf2-f3 Bd6-h2 Ne4xg5 => -794 not as good as 116
1)      116      116 Kf2-f3 Bd6-h2 => 116 not as good as 116
0)      116  2000000 Kf2-f3 => 116 not as good as 116
---------
So here it's showing what level it's currently on (the 1st move being 0). The depth is set to 2 so it will try one move for white and then one for black. It implements quiescence so it should complete and jump sequences. It will also try to stand pat. The scoring is approx 150 for a white pawn. The comments are generated automatically and the word CUT implies an alphabeta style cut.

The scoring may be a little odd but a pawn is worth approx 150. The score of -829 after Nxf6 or Nxg5 is simply because the program believes it has a winning position that's worth more than actual value of the pieces.

It appears the MVV/LVA ordering is correct but the score that's returned after a CUT seems crazy to me ie look at the last line after Kf2-f3 - this move somehow gets the same score as NxB.

I've obviously just shown a small part of the tree.
MVV/LVA move ording appears correct.
Sven Schüle wrote:Quite recently I wrote a very brief summary of alpha-beta, did you notice it?
I read your explanation a few times (about 5 times). I'm currently reading and try to understand the whole thread. I think I just need a child of 5 to explain things to me. :)

My current version of Fun Chess.