Anti-Engine Puzzle

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Anti-Engine Puzzle

Post by Michel »

Pio wrote: Tue Mar 09, 2021 10:59 pm
hgm wrote: Tue Mar 09, 2021 5:31 pm There is no PST in an EGT generator. And no white King either, the way I used it.
I am sorry. What I meant was that changing the PST for the white king should help solving the puzzle but it won’t fix it. Not generating moves for white king on e2 (and removing the moves from and to where the black pieces are (except the black king) should make any fast and bug free engine solve this problem in a couple of seconds since there are approximately 10 million positions.
I am not sure. At least my Stockfish does not solve KBN-K (also 4 pieces) "in a couple of seconds". Of course it gives it a very high score. But not a mate score.
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Anti-Engine Puzzle

Post by hgm »

That is also my experience. Forward alpha-beta search is very inefficient for solving these end-games. Problem is that it searches each one of these 10M positions over and over.

Funny thing is that minimax does much better! I once tried this in a Suicide version of Fairy-Max, to check whether the R vs K end-game was won. Fairy-Max' normal search took minutes, but when I fully opened the window in every node, to force minimax, it took only seconds! I would expect that to be the same here, provided the TT is large enough to hold the entire tree.
peter
Posts: 3185
Joined: Sat Feb 16, 2008 7:38 am
Full name: Peter Martan

Re: Anti-Engine Puzzle

Post by peter »

hgm wrote: Mon Mar 08, 2021 11:31 pm
It's a rather easy position for freezer from Eiko Bleicher.

http://www.freezerchess.com/

You simply have to define any move of one of Black's pieces except of the King as well as any capture- move as drawing. Of course, that's not quite correct, because some of these not winning moves are losing for White instead of drawing, but that doesn't mean a thing as for the moves winning for White, which are the only ones of interest.

So with these defined rules there are about 233 000 000 positions in database to be generated then, 1.Kf1 is the only one winning move, DTM 46, (all other first moves but single bm ...Kc5 are #45) and that's the .pgn- recording of one winning line with alternating (one of, if there's more then one with equal DTM,) best moves for each side played out:

[pgn][Event "Freezer Analysis"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "Freezer Analysis"]
[Black "?"]
[Result "1-0"]
[SetUp "1"]
[FEN "8/8/2k5/3N4/8/4N1p1/4Kprp/B5bn w - - 0 1"]
[PlyCount "91"]

1. Kf1 Kc5 2. Be5 Kb5 3. Nf5 Kc5 4. Nde7 Kb6 5. Bd6 Ka6 6. Ng7 Kb6 7. Ne6 Ka6
8. Nd8 Kb6 9. Nc8+ Kb5 10. Ba3 Kc4 11. Na7 Kb3 12. Be7 Kc3 13. Ne6 Kd3 14. Nc7
Kd4 15. Nab5+ Kc4 16. Bd6 Kb3 17. Bc5 Ka4 18. Nd6 Ka5 19. Bd4 Kb4 20. Be3 Ka5
21. Bc5 Ka4 22. Na6 Ka5 23. Nb8 Ka4 24. Nc6 Kb3 25. Bb4 Kc2 26. Nd4+ Kd3 27.
Ne6 Ke3 28. Bc3 Kd3 29. Bd4 Kd2 30. Nc5 Kc2 31. Nc4 Kc1 32. Ne3 Kd2 33. Nd5 Kc2
34. Bc3 Kc1 35. Nb4 Kb1 36. Nca6 Kc1 37. Nc7 Kb1 38. Nb5 Kc1 39. Na3 Kd1 40.
Nc6 Kc1 41. Na5 Kd1 42. Bb4 Kc1 43. N5c4 Kd1 44. Bc5 Kc1 45. Be3+ Kd1 46. Nb2#
1-0[/pgn]

.frz- database is about 455Mb regards
Peter.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Anti-Engine Puzzle

Post by hgm »

Indeed, Freezer also is an EGT generator of sorts.

Funny thing is that the checkmate is finally achieved in a place that is not very special; to the black King it looks like a normal corner, and white doesn't seem to make use of the fact that it could place pieces beyond this 'virtual edge'.

This seems to have something to do with the width of the edge. I modified my EGT generator now to play without white royals. (Only difference is that capture of the 'royal' piece by the black King only spoils the win if that piece was unprotected, like for the other white pieces.) On a normal 8x8 board BNN vs K then is a general draw (32.1% won, almost exclusively through immediate King capture, and 1.1% lost). But making the 2x2 areas in the four corners inaccessible, makes it a general win (98.9% won, 69.3% lost)!

Also, making only b1 inaccessible, makes it half won (65.2% won, 37.2% lost). Apparently the b1 obstacle makes it possible to force a mate on a1 or a2. But only when the Bishop is of the proper shade. When I make both b1 and b8 inaccessible, to enable the same mate in a corner of the other shad, the end-game is generally won again (99.2% won, 74.2% lost).
peter
Posts: 3185
Joined: Sat Feb 16, 2008 7:38 am
Full name: Peter Martan

Re: Anti-Engine Puzzle

Post by peter »

hgm wrote: Thu Mar 11, 2021 12:07 pm But only when the Bishop is of the proper shade.
Created two more freezer- databases. First one with Bishop at b1 instead of a1, so with changing its colour:

[d]8/8/2k5/3N4/8/4N1p1/4Kprp/1B4bn w - - 0 1 This one's drawn according to freezer.

Than another one position with all three light figures of White displaced, Bishop of same colour as in original position:

[d]5NNB/8/2k5/8/8/6p1/4Kprp/6bn w - - 0 1
This one's again won for White, database of about same bigness as first one,
.pgn- recording of one of the best lines again:
[pgn][Event "Freezer Analysis"]
[Site "?"]
[Date "????.??.??"]
[Round "?"]
[White "Freezer Analysis"]
[Black "?"]
[Result "*"]
[SetUp "1"]
[FEN "5NNB/8/2k5/8/8/6p1/4Kprp/6bn w - - 0 1"]
[PlyCount "91"]

1. Kf1 Kd6 2. Bg7 Kc6 3. Be5 Kd5 4. Bb8 Kc5 5. Ne6+ Kb5 6. Nd8 Kb6 7. Bd6 Kb5
8. Ne7 Kb6 9. Nc8+ Kb5 10. Ba3 Kc4 11. Na7 Kb3 12. Be7 Kc3 13. Ne6 Kd3 14. Nc7
Kd4 15. Nab5+ Kc4 16. Bd6 Kb3 17. Bc5 Ka4 18. Nd6 Ka5 19. Bd4 Kb4 20. Be3 Ka5
21. Bc5 Ka4 22. Na6 Ka5 23. Nb8 Ka4 24. Nc6 Kb3 25. Bb4 Kc2 26. Nd4+ Kd3 27.
Ne6 Ke3 28. Bc3 Kd3 29. Bd4 Kd2 30. Nc5 Kc2 31. Nc4 Kc1 32. Ne3 Kd2 33. Nd5 Kc2
34. Bc3 Kc1 35. Nb4 Kb1 36. Nca6 Kc1 37. Nc7 Kb1 38. Nb5 Kc1 39. Na3 Kd1 40.
Nc6 Kc1 41. Na5 Kd1 42. Bb4 Kc1 43. N5c4 Kd1 44. Bc5 Kc1 45. Be3+ Kd1 46. Nb2#
[/pgn]
Peter.
peter
Posts: 3185
Joined: Sat Feb 16, 2008 7:38 am
Full name: Peter Martan

Re: Anti-Engine Puzzle

Post by peter »

peter wrote: Thu Mar 11, 2021 2:47 pm
hgm wrote: Thu Mar 11, 2021 12:07 pm But only when the Bishop is of the proper shade.
Created two more freezer- databases. First one with Bishop at b1 instead of a1, so with changing its colour:
[d]8/8/2k5/3N4/8/4N1p1/4Kprp/1B4bn w - - 0 1 This one's drawn according to freezer.
Couldn't resist giving it another one try, this time mirroring the original position at midline to change field- colour of every figure on board:

[pgn][Event "Freezer Analysis"]
[White "Freezer Analysis"]
[Black " "]
[Result "*"]
[SetUp "1"]
[FEN "8/8/5k2/4N3/8/1p1N4/prpK4/nb5B w - - 0 1"]

1. Kc1 Kf5 2. Bd5 Kg5 3. Nb4 Kf5 4. Nbc6 Kg5 5. Nf7 Kg6
6. Nd6 Kg7 7. Bc4 Kh7 8. Ne8 Kh8 9. Bd5 Kh7 10. Bf7 Kh6
11. Ne7 Kh7 12. Ng6 Kh6 13. Nf8 Kg5 14. Bg6 Kf4 15. Nd7 Kg5
16. Bh7 Kh5 17. Nf8 Kg5 18. Ne6 Kh5 19. Bf5 Kh6 20. Be4 Kh5
21. Nf6 Kh6 22. Ng8 Kh5 23. Bf5 Kh4 24. Nf6 Kg3 25. Bg4 Kf2
26. Ne4 Ke3 27. Nd6 Kd3 28. Bf3 Ke3 29. Be4 Ke2 30. Nf5 Kf2
31. Nc5 Kf1 32. Nd3 Ke2 33. Ne5 Kf2 34. Bf3 Kf1 35. Ng4 Ke1
36. Nd6 Kf1 37. Nf7 Ke1 38. Ng5 Kf1 39. Nh3 Ke1 40. Ne5 Kf1
41. Ng6 Ke1 42. Bg4 Kf1 43. Ngf4 Ke1 44. Bf5 Kf1 45. Bd3 Ke1
46. Ng2[/pgn]
:) regards
Peter.
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Anti-Engine Puzzle

Post by Michel »

Interesting!!

I find it amazing that the optimal solution is 46 moves, which is exactly the same as the "official solution", but the official solution is very different.

Would it be possible to check with Freezer that the official solution is correct?
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
peter
Posts: 3185
Joined: Sat Feb 16, 2008 7:38 am
Full name: Peter Martan

Re: Anti-Engine Puzzle

Post by peter »

Michel wrote: Fri Mar 12, 2021 9:37 am Interesting!!

I find it amazing that the optimal solution is 46 moves, which is exactly the same as the "official solution", but the official solution is very different.

Would it be possible to check with Freezer that the official solution is correct?
Well, I'd say, that's what I already did here, cause the official solution isn't very diferent at all to freezer's one to me, as for the way of forcing the mate, except that another one possible mating field is chosen. Have a closer look at the two solution- lines:

http://talkchess.com/forum3/viewtopic.p ... 75#p886675

Bu maybe you mean, to give in each move of author's solution into database, of course I could try this too, but it would take some time having to read out 46 moves of one .pgn and give them in manually into board of database. When I'll find time for that, I'll give it a try and return.

Don't know when but till then regards
:)
Peter.
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Anti-Engine Puzzle

Post by Michel »

peter wrote: Fri Mar 12, 2021 10:04 am
Michel wrote: Fri Mar 12, 2021 9:37 am Interesting!!

I find it amazing that the optimal solution is 46 moves, which is exactly the same as the "official solution", but the official solution is very different.

Would it be possible to check with Freezer that the official solution is correct?
Well, I'd say, that's what I already did here, cause the official solution isn't very diferent at all to freezer's one to me, as for the way of forcing the mate, except that another one possible mating field is chosen. Have a closer look at the two solution- lines:

http://talkchess.com/forum3/viewtopic.p ... 75#p886675

Bu maybe you mean, to give in each move of author's solution into database, of course I could try this too, but it would take some time having to read out 46 moves of one .pgn and give them in manually into board of database. When I'll find time for that, I'll give it a try and return.

Don't know when but till then regards
:)
Of course. I am just surprised that someone without a computer could produce a seemingly optimal solution....
Ideas=science. Simplification=engineering.
Without ideas there is nothing to simplify.
User avatar
towforce
Posts: 11542
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK

Re: Anti-Engine Puzzle

Post by towforce »

Michel wrote: Fri Mar 12, 2021 12:01 pmOf course. I am just surprised that someone without a computer could produce a seemingly optimal solution....

Maybe the author found a pattern of moves to move the king around, and that pattern can't be bettered.
Writing is the antidote to confusion.
It's not "how smart you are", it's "how are you smart".
Your brain doesn't work the way you want, so train it!