idea to estimate the percentage of drawn positions in chess

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

Moderator: Ras

User avatar
Brunetti
Posts: 424
Joined: Tue Dec 08, 2009 1:37 pm
Location: Milan, Italy
Full name: Alex Brunetti

Re: idea to estimate the percentage of drawn positions in chess

Post by Brunetti »

fkarger wrote: Thu Apr 17, 2025 10:21 am He (Brunetti) wrote about a 'billionth' not a billion.
That is one in a billion :)

Alex
User avatar
Brunetti
Posts: 424
Joined: Tue Dec 08, 2009 1:37 pm
Location: Milan, Italy
Full name: Alex Brunetti

Re: idea to estimate the percentage of drawn positions in chess

Post by Brunetti »

petero2 wrote: Wed Apr 16, 2025 7:11 pm I extracted the legal positions from https://raw.githubusercontent.com/tromp ... .out.95544, shuffled them and analyzed them one at a time. The 22nd position I analyzed was this
Quite amazing. How did you exactly create the file? Fully randomly?

Alex
User avatar
towforce
Posts: 12296
Joined: Thu Mar 09, 2006 12:57 am
Location: Birmingham UK
Full name: Graham Laight

Re: idea to estimate the percentage of drawn positions in chess

Post by towforce »

Another approach:

1. Create a God Algorithm that correctly determines the result of a given position (note: this step is non trivial)

2. Apply it to all positions in a database of chess games

Alternative to (2): write a program that generates random legal and reachable positions.
Yesterday, upon the stair,
I met a man who wasn't there!
He wasn't there again today,
I wish, I wish he'd go away!
petero2
Posts: 722
Joined: Mon Apr 19, 2010 7:07 pm
Location: Sweden
Full name: Peter Osterlund

Re: idea to estimate the percentage of drawn positions in chess

Post by petero2 »

Brunetti wrote: Thu Apr 17, 2025 11:12 am
petero2 wrote: Wed Apr 16, 2025 7:11 pm I extracted the legal positions from https://raw.githubusercontent.com/tromp ... .out.95544, shuffled them and analyzed them one at a time. The 22nd position I analyzed was this
Quite amazing. How did you exactly create the file? Fully randomly?
There was a whole talkchess thread about it and some documents created, see links at the end.

In short, the positions are "fully random" in the sense that every legal (reachable from the start position) position had the same probability to be included in the sample. It was constructed like this:
  1. Create a set S that contains all legal chess positions and optionally some non-legal positions. John Tromp constructed such a set of size N ~= 8.7e45.
  2. Create a one-to-one mapping between the positions in S and the integers 1, 2, ..., N. Tromp constructed such a mapping too.
  3. Create a random sample from the integers 1, 2, ..., N. Convert each integer to the corresponding chess position.
  4. For each position, determine if it is legal. I created a program that can do this in most cases. The remaining positions have to be analyzed by hand.
The file I linked to before contains all legal positions (and some non-legal positions) that resulted from applying the above procedure.

viewtopic.php?f=7&t=77685
https://github.com/tromp/ChessPositionRanking
https://github.com/peterosterlund2/texe ... oofgame.md
Jouni
Posts: 3611
Joined: Wed Mar 08, 2006 8:15 pm
Full name: Jouni Uski

Re: idea to estimate the percentage of drawn positions in chess

Post by Jouni »

Isn't example position clear draw?!
Analysis by Stockfish 17.1:

1. = (0.00): 2.Re8+ Kxf7 3.Bxg6+ Kxg6 4.gxf5+ Nxf5 5.f7+ Nxe6 6.Rxe6+ Kg7 7.Bf6+ Kh7 8.Bxg2 Nf8 9.Bxh3 dxe2+ 10.Kxe2 Ng3+ 11.Kf3 exd2 12.Kxg3 d1Q 13.Rxb4 Nxb4 14.Bxg5 Nd6 15.Kh2 Ne4 16.Bh6 Qe2+ 17.Bg2 Qh5+ 18.Kg1 Qd1+ 19.Kh2 Qg4 20.Bxf8 Qg3+ 21.Kh1 Qh4+ 22.Kg1 Qe1+ 23.Kh2
2. -+ (-#4): 2.Bxg2 dxe2+ 3.Kg1 e1Q+ 4.Kh2 Qg3+ 5.Kh1 Qxg2#
3. -+ (-#3): 2.Rxe3 Nxd2+ 3.Ke1 N2xf3+ 4.Kf1 Nh2#
4. -+ (-#3): 2.Rxd3 Rf2+ 3.Kg1 Nxf3+ 4.Kh1 Rh2#
Jouni
fkarger
Posts: 47
Joined: Sat Aug 15, 2020 8:08 am
Full name: Frank Karger

Re: idea to estimate the percentage of drawn positions in chess

Post by fkarger »

The first line is (0.00) but if you go into the line you see that it is not forced.
Only a forced draw would be a proven draw.
jefk
Posts: 920
Joined: Sun Jul 25, 2010 10:07 pm
Location: the Netherlands
Full name: Jef Kaan

Re: idea to estimate the percentage of drawn positions in chess

Post by jefk »

There will be people who who say you cannot say if a position is
drawn unless you can prove it with a tablebase.
Mathematically correct maybe, but not realistic because there's a drawing
margin, and within that margin a position will stay drawish. Sure i can think
of a position which looks drawish and only after >60 ply analysis then suddenly
it the position isn't a draws after all. But then with retro analysis of the (imaginary?)
game you can see that White of Black could have avoided such a positions.

Ergo, in general, if Black plays correctly, and White not too bad, then the percentage
of drawn positions in chess is 100 pct (unless one side makes a mistake).
jefk
Posts: 920
Joined: Sun Jul 25, 2010 10:07 pm
Location: the Netherlands
Full name: Jef Kaan

Re: idea to estimate the percentage of drawn positions in chess

Post by jefk »

adding to that, there are positions ofcourse which are not a result of a normal game;
first 1) arbitrary positions, without any requirement that it's a (legal) result of a normal move
sequence. Second, 2) positions which are a result of a 'game', ie legal sequence of moves
no matter how crazy this sequence may have been.

Rough subjective estimate of the nr of draw positions:
4+/-2 pct of category 1)
and 7 +/-3 for category 2).
Just a first estimate, i may be wrong, it's difficult to estimate this without looking at
the real nrs; which someone else might do (SF7 with 25 ply and a score within +/- 0.15
may count as 'draw' (although that ofcourse isn't always certain, but probably
in >99 pct of such positions).
fkarger
Posts: 47
Joined: Sat Aug 15, 2020 8:08 am
Full name: Frank Karger

Re: idea to estimate the percentage of drawn positions in chess

Post by fkarger »

I think the draw rate could be much higher.

If you look at the TCEC results even a difference of > 0.5 in most cases leads to a draw.
chesskobra
Posts: 347
Joined: Thu Jul 21, 2022 12:30 am
Full name: Chesskobra

Re: idea to estimate the percentage of drawn positions in chess

Post by chesskobra »

TCEC positions are not relevant. They arise from biased openings and strong engines.

But if we are sampling uniformly from all legal positions, then my intuition is that almost all positions will be very imbalanced, and almost all imbalanced positions will be winning for one side.

If we sample uniformly, say at move around 20, from games between strong engines, with no opening book, then most positions will be drawish. But in an actual experiment one has to be careful and not sample exactly after n moves, because one side may have captured a piece at the end of n full moves and the other side may be going to capture it back, so sampling exactly after n moves will be biased.