English: Chess game between TUROCHAMP (with its moves calculated by Alan Turing) and Alick Glennie in 1952. After 29 moves, TUROCHAMP is in a lost position and resigns.
#!/usr/bin/env python3# Plot the TUROCHAMP-Glennie game using python-chess and ImageMagickimportosimportchess.pgnimportchess.svgpgn=open('glennie.pgn')game=chess.pgn.read_game(pgn)board=game.board()defsvg(i):lm=board.peek()a=[(lm.from_square,lm.to_square)]s=chess.svg.board(board,arrows=a,size=800)f1="g_%04u.svg"%if2="g_%04u.png"%iwithopen(f1,'w')asf:f.write(s)os.system("convert %s%s"%(f1,f2))i=1formingame.mainline_moves():board.push(m)svg(i)i+=1# pause animation at the end:forjinrange(3):svg(i)i+=1# Now you can create the GIF animation with:# convert -delay 150 g_*.png -loop 0 g.gif
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.
http://creativecommons.org/publicdomain/zero/1.0/deed.enCC0Creative Commons Zero, Public Domain Dedicationfalsefalse
Captions
Add a one-line explanation of what this file represents