Skip to main content
12 events
when toggle format what by license comment
Sep 20, 2022 at 23:14 answer added Abhinav S. timeline score: 0
Jul 21, 2021 at 6:53 vote accept MattY
Jul 19, 2021 at 22:09 comment added Kevin FYI, game.board() is expensive because it is re-evaluating the entire game from move one every time you call that method! Since the logic in that method does not look terribly complicated, you could probably rewrite it yourself to iterate over each board in a single pass.
Jul 19, 2021 at 13:50 answer added kentdjb timeline score: 5
Jul 19, 2021 at 6:37 comment added Hauke Reddmann I took a look at the documentation of PythonChess. First Impression: Very meticulous, very by-the-book-of-good-programming. But your use case needs speed (100 games/2 seconds sounds slow to me either) and it might be more effective to grin and bear it, throw the nice features of PythonChess out of the window, program from scratch and optimize for speed.
Jul 18, 2021 at 22:58 comment added MattY @HaukeReddmann I updated the post with complete code. Note that the script's able to process 100 games every 2 seconds, which means my little database of 400k games will take over 2 hours, and larger databases will take forever.
Jul 18, 2021 at 22:55 history edited MattY CC BY-SA 4.0
added 2936 characters in body
Jul 18, 2021 at 18:38 comment added MattY @HaukeReddmann One caveat is that I need the strings to comply with the FEN standard for my downstream use case. That means encoding legal en-passant moves, and so on. So, for that reason, I'd love to NOT generate the FEN strings myself!
Jul 18, 2021 at 15:28 comment added Hauke Reddmann "Fast" is relative: Object-oriented+Python = you see the taillights of me old FORTRAN guy :-) Still, I program in Python a lot and a simple string parsing app should work fast enough (maybe unless you have millions of games), so mind to give some concrete timing values? And structure and example data for your variables? It might work faster the obvious way: starting from RNBQ.../ and parse the moves of the PGN directly, updating the FEN.
Jul 18, 2021 at 10:52 history edited MattY CC BY-SA 4.0
added 66 characters in body
Jul 18, 2021 at 10:50 review First posts
Jul 18, 2021 at 11:05
Jul 18, 2021 at 10:46 history asked MattY CC BY-SA 4.0