repetition draw bug

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Some minor ambiguities concerning game termination

Post by sje »

stevemulligan wrote:Are there any compiled linux apps that I will play a random game and save to PGN format? I could run that and collect a big library of repetitions/50 move pgn's. If left to my own devices I'm gonna fire up Perl again :p
I might be able to help with sending some random game PGN data via email. How many games would you like?
User avatar
stevemulligan
Posts: 117
Joined: Wed Jul 20, 2011 2:54 pm
Location: Ottawa, Canada

Re: Some minor ambiguities concerning game termination

Post by stevemulligan »

I'm guessing around 100k each of 3 & 50 move reps would be a good test. So about 4 million random games.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Some minor ambiguities concerning game termination

Post by sje »

stevemulligan wrote:I'm guessing around 100k each of 3 & 50 move reps would be a good test. So about 4 million random games.
That's several GB of data. Even if your email can handle it, mine can't.

Give me a little time to see what I can do.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Some files with random PGN games

Post by sje »

Some files with random PGN games can be found at:

https://public.me.com/chessnotation -> RandomGames

(It may take a while to synchronize.)

Random PGN average length: about 2 KB

The result data (1-0, 0-1, 1/2-1/2) are shown; not the reason. Let me know if you want the termination reason shown as well; that would take some time.
User avatar
stevemulligan
Posts: 117
Joined: Wed Jul 20, 2011 2:54 pm
Location: Ottawa, Canada

Re: Some files with random PGN games

Post by stevemulligan »

Thx. I'm getting the 100k game file now.

Here is the python script I'm going to use to collect all the different endings. It requires pyChess to run.

http://pwnedthegameofchess.com/pgn/
User avatar
stevemulligan
Posts: 117
Joined: Wed Jul 20, 2011 2:54 pm
Location: Ottawa, Canada

Re: Some files with random PGN games

Post by stevemulligan »

sje wrote:Let me know if you want the termination reason shown as well; that would take some time.
Ok I extracted the games from the 100k file and grouped them together by ending type. These are NOT verified by anyone yet.

http://pwnedthegameofchess.com/pgn/game_endings.zip (84MB)

Here are the counts that I got.

55872 insuf
15430 checkmates
6127 stalemates
19891 fifty move
2680 repetition
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Some files with random PGN games

Post by sje »

stevemulligan wrote:Ok I extracted the games from the 100k file and grouped them together by ending type. These are NOT verified by anyone yet.

http://pwnedthegameofchess.com/pgn/game_endings.zip (84MB)

Here are the counts that I got.

55872 insuf
15430 checkmates
6127 stalemates
19891 fifty move
2680 repetition
These look very close to the expected percentages.

When I get a chance, I'll run my own scan. But it will take a little bit of coding first.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Some files with random PGN games

Post by sje »

A conflict with the checkmate count (your number 15430):

Code: Select all

gail:tmp sje$ grep "#" rg100000.pgn | wc -l
   15438
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Some files with random PGN games

Post by sje »

And upon further examination, it looks like some of the Result tag values are wrong.

Code: Select all

gail:tmp sje$ grep "1-0" rg100000.pgn | grep Result |wc -l
    7716
gail:tmp sje$ grep "0-1" rg100000.pgn | grep Result | wc -l
    7716  (Wow!  An unlikely match)
gail:tmp sje$ grep "1/2-1/2" rg100000.pgn | grep Result | wc -l
   84568
The Result tags say 15,432 checkmates but the game termination markers say 15,438 checkmates. So apparently the Result tag guy is using a different, and likely faulty, scheme compared with the game termination guy.
User avatar
stevemulligan
Posts: 117
Joined: Wed Jul 20, 2011 2:54 pm
Location: Ottawa, Canada

Re: Some files with random PGN games

Post by stevemulligan »

Some of the termination markers end with # 1/2-1/2 (none of the stalemates..).

eg, pyChess saw this as a 50 move game but the termination marker is "# 1/2-1/2"

Code: Select all


[Event "Random Game"]
[Site "gail"]
[Date "2011.10.06"]
[Round "1"]
[White "'-'"]
[Black "'-'"]
[Result "1/2-1/2"]
[Time "19:01:00"]
[PlyCount "283"]

1. d4 f6 2. Nh3 c5 3. Bf4 Na6 4. Nd2 Nc7 5. Bxc7 f5 6. g4 h6 7. a3 e5 8. dxe5
g5 9. Qb1 Bd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Ra8 Ke4 96. Rab8 Kf3 97. Rg8 Ke3
98. Rc6+ Kf3 99. Rgg6 Ke4 100. Bb8 Kf5 101. Kc1 Ke4 102. Rg8 Kf3 103. Bf4 Ke2
104. Rc7 Kf1 105. Rb8 Ke1 106. Rc6 Kf2 107. Be5 Ke2 108. Rc7 Kf3 109. Rc2 Ke4
110. Rb6 Ke3 111. Rcb2 Kd3 112. Bg7 Ke4 113. Rh2 Kf4 114. Rbb2 Kf5 115. Kd1 Kf4
116. Rhf2+ Ke3 117. Rb5 Ke4 118. Rd2 Ke3 119. Bb2 Kf4 120. Kc2 Kf3 121. Kd1 Ke4
122. Re5+ Kf4 123. Rb5 Kg3 124. Bc1 Kf4 125. Rf2+ Kg3 126. Rd2 Kh4 127. Rb1 Kh5
128. Rd3 Kg6 129. Bb2 Kf5 130. Rd8 Kg5 131. Bf6+ Kg4 132. Rd4+ Kf3 133. Rb6 Kg3
134. Ke2 Kh2 135. Rb2 Kg2 136. Kd1+ Kg3 137. Kd2 Kh3 138. Bg7 Kh2 139. Rd3 Kh1
140. Kc1 Kg1 141. Rd6 Kf1 142. Rd1# 1/2-1/2
There are 6 games like this that were counted as a 50 move ending.

The other 2 missing checkmates were counted as insufficient material. I commented out lines 51-53 in Utils/logic.py from pyChess and they were counted as checkmates.