Page 2 of 3

Re: max number of pseudo legal move

Posted: Tue Jun 11, 2019 4:32 pm
by MikeB
xr_a_y wrote:
Sun Jun 09, 2019 3:14 pm
is there a worst position than this one

[d] 3Q4/1Q4Q1/4Q3/2Q4R/Q4Q2/3Q4/1Q4Rp/1K1BBNNk w - - 0 1

218 pseudo legal moves ?
Yes that's the one. Real world, from real games , not proof games, the record as far I know is 79 moves. I performed a search once , using a move generator on 1 million games and found a game with 78 possible moves . I posted the game here, years ago - maybe 10 to 13 years ago.

The real game record:
https://timkr.home.xs4all.nl/records/re ... d%20pieces

Re: max number of pseudo legal move

Posted: Tue Jun 11, 2019 4:50 pm
by JohnWoe
Logged Sapeli's maximum moves from standard games against Fairy:
https://pastebin.com/HU2CQvZm

79 moves is the maximum currently.
I think 128 is plenty for gameplay. For analyzing 256 is bullet proof.

Re: max number of pseudo legal move

Posted: Tue Jun 11, 2019 5:17 pm
by xr_a_y
JohnWoe wrote:
Tue Jun 11, 2019 4:50 pm
Logged Sapeli's maximum moves from standard games against Fairy:
https://pastebin.com/HU2CQvZm

79 moves is the maximum currently.
I think 128 is plenty for gameplay. For analyzing 256 is bullet proof.
I agree. I really don't know how I've came up with the 512 initially ...

Re: Maximum number of pseudo legal moves.

Posted: Tue Jun 11, 2019 8:58 pm
by Ajedrecista
Hello Mike:
MikeB wrote:[...] Real world, from real games , not proof games, the record as far I know is 79 moves. I performed a search once , using a move generator on 1 million games and found a game with 78 possible moves . I posted the game here, years ago - maybe 10 to 13 years ago.

The real game record:
https://timkr.home.xs4all.nl/records/re ... d%20pieces
I downloaded CCRL 40/4 games (CCRL-404.[2047025].pgn, so 2047025 games) and I found positions with perft(1) > 79. There is at least one position in this PGN with perft(1) = 85 because I saw that info while the fantastic tool joined was running, before it was overwritten by other position with perft(1) = 89 and later by others with perft(1) = 98, perft(1) = 102 and perft(1) = 124. There might be other positions found later with 79 < perft(1) =< 124:

Code: Select all

.\joined>joined -h
Illegal option: h !
Usage: joined [<*.PGN, *.FEN or *.EPD file>] [-<options>]
Legal options are:
   -p        : Print messages to both stderr and stdout
   -q        : Quit after scanning input file
   -r        : Initial value for random algorithm
   -s        : Print messages only to stdout
   -v<number>: Set verbose level to <number> (default 4)
      The numbers may be added. The numbers are:
       1: Print PGN
       2: Calculate number of legal moves in all positions
       4: Print progress (default)
       8: Print all warnings
      16: Check PGN
      32: Report result = '*'
      64: Get statistics on all types of moves
***** Error exit *****

.\joined>joined -q -v6 CCRL-404.[2047025].pgn
Scanning file CCRL-404.[2047025].pgn containing 2324578752 bytes !

[...]

Read 2047025 games with 282012002 moves, 53150521 lines, 2324578752 bytes !
Got max. 799 moves in game 1013473 before line 26659054 !
Got 3536229011 legal moves in 284059027 positons !
Got max. 124 legal moves after move 288 in game 892029 line 23469623 !
Verbose level -v6 is 2 + 4 = 6 ('Calculate number of legal moves in all positions' and 'Print progress').

Since I can only track the position with the maximum[perft(1)], the game where it arose is the following one:



The position with perft(1) = 124 is the next one just after 288 plies, as reported by joined:

[d]5Q2/1QRB3k/4R3/3QQ3/3Q4/4Q3/4QK2/8 w - - 3 145

Which perft(1) = 124 was verified by JetChess perft counter:

Code: Select all

JetChess 1.0.0.0:

5Q2/1QRB3k/4R3/3QQ3/3Q4/4Q3/4QK2/8 w - - 3 145

perft(1) = 124
--------------
  1  Qe2-d3
  2  Qe2-c4
  3  Qe2-b5
  4  Qe2-a6
  5  Qe2-f3
  6  Qe2-g4
  7  Qe2-h5
  8  Qe2-f1
  9  Qe2-d1
 10  Qe2-d2
 11  Qe2-c2
 12  Qe2-b2
 13  Qe2-a2
 14  Qe2-e1
 15  Qe3-f4
 16  Qe3-g5
 17  Qe3-h6
 18  Qe3-d2
 19  Qe3-c1
 20  Qe3-e4
 21  Qe3-f3
 22  Qe3-g3
 23  Qe3-h3
 24  Qe3-d3
 25  Qe3-c3
 26  Qe3-b3
 27  Qe3-a3
 28  Qd4-c5
 29  Qd4-b6
 30  Qd4-a7
 31  Qd4-c3
 32  Qd4-b2
 33  Qd4-a1
 34  Qd4-e4
 35  Qd4-f4
 36  Qd4-g4
 37  Qd4-h4
 38  Qd4-c4
 39  Qd4-b4
 40  Qd4-a4
 41  Qd4-d3
 42  Qd4-d2
 43  Qd4-d1
 44  Qd5-c6
 45  Qd5-e4
 46  Qd5-f3
 47  Qd5-g2
 48  Qd5-h1
 49  Qd5-c4
 50  Qd5-b3
 51  Qd5-a2
 52  Qd5-d6
 53  Qd5-c5
 54  Qd5-b5
 55  Qd5-a5
 56  Qe5-d6
 57  Qe5-f6
 58  Qe5-g7
 59  Qe5-h8
 60  Qe5-f4
 61  Qe5-g3
 62  Qe5-h2
 63  Qe5-f5
 64  Qe5-g5
 65  Qe5-h5
 66  Qe5-e4
 67  Qb7-a8
 68  Qb7-c8
 69  Qb7-c6
 70  Qb7-a6
 71  Qb7-b8
 72  Qb7-a7
 73  Qb7-b6
 74  Qb7-b5
 75  Qb7-b4
 76  Qb7-b3
 77  Qb7-b2
 78  Qb7-b1
 79  Qf8-g7
 80  Qf8-h6
 81  Qf8-e7
 82  Qf8-d6
 83  Qf8-c5
 84  Qf8-b4
 85  Qf8-a3
 86  Qf8-g8
 87  Qf8-h8
 88  Qf8-e8
 89  Qf8-d8
 90  Qf8-c8
 91  Qf8-b8
 92  Qf8-a8
 93  Qf8-f7
 94  Qf8-f6
 95  Qf8-f5
 96  Qf8-f4
 97  Qf8-f3
 98  Re6-e7
 99  Re6-e8
100  Re6-f6
101  Re6-g6
102  Re6-h6
103  Re6-d6
104  Re6-c6
105  Re6-b6
106  Re6-a6
107  Rc7-c8
108  Rc7-c6
109  Rc7-c5
110  Rc7-c4
111  Rc7-c3
112  Rc7-c2
113  Rc7-c1
114  Bd7-c8
115  Bd7-e8
116  Bd7-c6
117  Bd7-b5
118  Bd7-a4
119  Kf2-g2
120  Kf2-f3
121  Kf2-g3
122  Kf2-e1
123  Kf2-f1
124  Kf2-g1
It is a real game since it is not a composition, although the level of the engines was really low. To force a threefold repetition with the winning side in a KQQQQQQRRB-vs-k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3 Qgg5 Qgg6 Qgg7 Qgg8 Qgh3 Qgh4 Qgh5 Qh6g6 Qhb7 Qhc7 Qhd2 Qhd6 Qhd7 Qhe3 Qhe4 Qhe6 Qhe7 Qhf4 Qhf5 Qhf6 Qhf7 Qhf8 Qhg5 Qhg8 Qhh3 Qhh4 Qhh5 Qhh8 Qhxh2+ Ra3 Ra4 Ra5 Ra6 Ra8 Raf7 Rb2 Rb7 Rc2 Rc7 Rd2 Rd7 Re2 Re7 Rf3 Rf4 Rf5 Rf6 Rf8 Rff7 Rg7
and all of them result in mate in 2.
One example:
Nge3+ Qg2 Qhxh2#

Re: max number of pseudo legal move

Posted: Tue Jun 11, 2019 11:47 pm
by Uri Blass
JohnWoe wrote:
Tue Jun 11, 2019 4:50 pm
Logged Sapeli's maximum moves from standard games against Fairy:
https://pastebin.com/HU2CQvZm

79 moves is the maximum currently.
I think 128 is plenty for gameplay. For analyzing 256 is bullet proof.
I will be surprised if 79 moves is the maximum for human games.

There are many games between children when the weaker side does not resign and the stronger side prefer to promote many pawns to queens instead of making mate fast and I am sure that some of them have more than 79 moves.

Re: max number of pseudo legal move

Posted: Wed Jun 12, 2019 1:30 am
by bob
A LONG time ago, I decided to make this particular question a non issue. I use a big array (vector). I have another vector last[ply]. The idea is then that for all plies, last[ply] points one past the last move for the current ply. If you want to iterate over the complete move list for ply=4, you do something like:

for (move=last[3]; move < last[4]; move++) { loop stuff }

all you have to do is make the vector of moves large enough to hold all the moves from all the plies. There are no gaps this way, no "cache unfriendliness" and such either. And it is very simple.

Re: Maximum number of pseudo legal moves.

Posted: Wed Jun 12, 2019 1:41 am
by MikeB
Ajedrecista wrote:
Tue Jun 11, 2019 8:58 pm
Hello Mike:
MikeB wrote:[...] Real world, from real games , not proof games, the record as far I know is 79 moves. I performed a search once , using a move generator on 1 million games and found a game with 78 possible moves . I posted the game here, years ago - maybe 10 to 13 years ago.

The real game record:
https://timkr.home.xs4all.nl/records/re ... d%20pieces
I downloaded CCRL 40/4 games (CCRL-404.[2047025].pgn, so 2047025 games) and I found positions with perft(1) > 79. There is at least one position in this PGN with perft(1) = 85 because I saw that info while the fantastic tool joined was running, before it was overwritten by other position with perft(1) = 89 and later by others with perft(1) = 98, perft(1) = 102 and perft(1) = 124. There might be other positions found later with 79 < perft(1) =< 124:

Code: Select all

.\joined>joined -h
Illegal option: h !
Usage: joined [<*.PGN, *.FEN or *.EPD file>] [-<options>]
Legal options are:
   -p        : Print messages to both stderr and stdout
   -q        : Quit after scanning input file
   -r        : Initial value for random algorithm
   -s        : Print messages only to stdout
   -v<number>: Set verbose level to <number> (default 4)
      The numbers may be added. The numbers are:
       1: Print PGN
       2: Calculate number of legal moves in all positions
       4: Print progress (default)
       8: Print all warnings
      16: Check PGN
      32: Report result = '*'
      64: Get statistics on all types of moves
***** Error exit *****

.\joined>joined -q -v6 CCRL-404.[2047025].pgn
Scanning file CCRL-404.[2047025].pgn containing 2324578752 bytes !

[...]

Read 2047025 games with 282012002 moves, 53150521 lines, 2324578752 bytes !
Got max. 799 moves in game 1013473 before line 26659054 !
Got 3536229011 legal moves in 284059027 positons !
Got max. 124 legal moves after move 288 in game 892029 line 23469623 !
Verbose level -v6 is 2 + 4 = 6 ('Calculate number of legal moves in all positions' and 'Print progress').

Since I can only track the position with the maximum[perft(1)], the game where it arose is the following one:



The position with perft(1) = 124 is the next one just after 288 plies, as reported by joined:

[d]5Q2/1QRB3k/4R3/3QQ3/3Q4/4Q3/4QK2/8 w - - 3 145

Which perft(1) = 124 was verified by JetChess perft counter:

Code: Select all

JetChess 1.0.0.0:

5Q2/1QRB3k/4R3/3QQ3/3Q4/4Q3/4QK2/8 w - - 3 145

perft(1) = 124
--------------
  1  Qe2-d3
  2  Qe2-c4
  3  Qe2-b5
  4  Qe2-a6
  5  Qe2-f3
  6  Qe2-g4
  7  Qe2-h5
  8  Qe2-f1
  9  Qe2-d1
 10  Qe2-d2
 11  Qe2-c2
 12  Qe2-b2
 13  Qe2-a2
 14  Qe2-e1
 15  Qe3-f4
 16  Qe3-g5
 17  Qe3-h6
 18  Qe3-d2
 19  Qe3-c1
 20  Qe3-e4
 21  Qe3-f3
 22  Qe3-g3
 23  Qe3-h3
 24  Qe3-d3
 25  Qe3-c3
 26  Qe3-b3
 27  Qe3-a3
 28  Qd4-c5
 29  Qd4-b6
 30  Qd4-a7
 31  Qd4-c3
 32  Qd4-b2
 33  Qd4-a1
 34  Qd4-e4
 35  Qd4-f4
 36  Qd4-g4
 37  Qd4-h4
 38  Qd4-c4
 39  Qd4-b4
 40  Qd4-a4
 41  Qd4-d3
 42  Qd4-d2
 43  Qd4-d1
 44  Qd5-c6
 45  Qd5-e4
 46  Qd5-f3
 47  Qd5-g2
 48  Qd5-h1
 49  Qd5-c4
 50  Qd5-b3
 51  Qd5-a2
 52  Qd5-d6
 53  Qd5-c5
 54  Qd5-b5
 55  Qd5-a5
 56  Qe5-d6
 57  Qe5-f6
 58  Qe5-g7
 59  Qe5-h8
 60  Qe5-f4
 61  Qe5-g3
 62  Qe5-h2
 63  Qe5-f5
 64  Qe5-g5
 65  Qe5-h5
 66  Qe5-e4
 67  Qb7-a8
 68  Qb7-c8
 69  Qb7-c6
 70  Qb7-a6
 71  Qb7-b8
 72  Qb7-a7
 73  Qb7-b6
 74  Qb7-b5
 75  Qb7-b4
 76  Qb7-b3
 77  Qb7-b2
 78  Qb7-b1
 79  Qf8-g7
 80  Qf8-h6
 81  Qf8-e7
 82  Qf8-d6
 83  Qf8-c5
 84  Qf8-b4
 85  Qf8-a3
 86  Qf8-g8
 87  Qf8-h8
 88  Qf8-e8
 89  Qf8-d8
 90  Qf8-c8
 91  Qf8-b8
 92  Qf8-a8
 93  Qf8-f7
 94  Qf8-f6
 95  Qf8-f5
 96  Qf8-f4
 97  Qf8-f3
 98  Re6-e7
 99  Re6-e8
100  Re6-f6
101  Re6-g6
102  Re6-h6
103  Re6-d6
104  Re6-c6
105  Re6-b6
106  Re6-a6
107  Rc7-c8
108  Rc7-c6
109  Rc7-c5
110  Rc7-c4
111  Rc7-c3
112  Rc7-c2
113  Rc7-c1
114  Bd7-c8
115  Bd7-e8
116  Bd7-c6
117  Bd7-b5
118  Bd7-a4
119  Kf2-g2
120  Kf2-f3
121  Kf2-g3
122  Kf2-e1
123  Kf2-f1
124  Kf2-g1
It is a real game since it is not a composition, although the level of the engines was really low. To force a threefold repetition with the winning side in a KQQQQQQRRB-vs-k position has its merit. ;)

This task can be repeated with CCRL 40/40 games, CEGT, SSDF and so on. I chose CCRL 40/4 for its high amount of games.

Regards from Spain.

Ajedrecista.
+1 HAHA - nice find. Good to see CCRL tests engines of all strengths!

Re: max number of pseudo legal move

Posted: Wed Jun 12, 2019 6:46 am
by Dann Corbit
I can actually see beads of sweat on the black king's head. Judging by the posts in this thread, I would say he is having a bad day.

Re: max number of pseudo legal move

Posted: Thu Jun 13, 2019 11:45 am
by Roland Chastain
Dann, I like very much your "205 best moves" position. :)

By the way, the official JetChess web page no longer exists. Would you know another place where one can download it?