File:Levitsky vs Marshall, 1912.gif

Original file(800 × 800 pixels, file size: 2.26 MB, MIME type: image/gif, looped, 49 frames, 1 min 14 s)

Summary

Description
English: Levitsky versus Marshall (1912) chess game animation
Date
Source Own work
Author Morn
GIF development
InfoField
Python-logo-notext 
This GIF graphic was created with Python.
Source code
InfoField

Python code

Source code
#!/usr/bin/env python3

# Plot a PGN game using python-chess and ImageMagick

import os
import chess.pgn
import chess.svg

pgn = open('levitsky_marshall_1912.pgn')
game = chess.pgn.read_game(pgn)
board = game.board()

def svg(i):
    lm = board.peek()
    a = [(lm.from_square, lm.to_square)]
    s = chess.svg.board(board, arrows = a, size = 800)

    f1 = "g_%04u.svg" % i
    f2 = "g_%04u.png" % i

    with open(f1, 'w') as f:
        f.write(s)
    os.system("convert %s %s" % (f1, f2))
    os.system("rm %s" % f1)

i = 1

for m in game.mainline_moves():
    board.push(m)
    svg(i)
    i += 1

# pause animation at the end:
for j in range(3):
    svg(i)
    i += 1

# create animation with
# convert -delay 150 g_*.png -loop 0 g.gif

PGN

[Event "18th DSB Kongress"]
[Site "Breslau GER"]
[Date "1912.07.20"]
[EventDate "1912.07.15"]
[Round "6"]
[Result "0-1"]
[White "Stefan Levitsky"]
[Black "Frank James Marshall"]
[ECO "B23"]
[WhiteElo "?"]
[BlackElo "?"]
[PlyCount "46"]

1.d4 e6 2.e4 d5 3.Nc3 c5 4.Nf3 Nc6 5.exd5 exd5 6.Be2 Nf6 7.O-O
Be7 8.Bg5 O-O 9.dxc5 Be6 10.Nd4 Bxc5 11.Nxe6 fxe6 12.Bg4 Qd6
13.Bh3 Rae8 14.Qd2 Bb4 15.Bxf6 Rxf6 16.Rad1 Qc5 17.Qe2 Bxc3
18.bxc3 Qxc3 19.Rxd5 Nd4 20.Qh5 Ref8 21.Re5 Rh6 22.Qg5 Rxh3
23.Rc5 Qg3 0-1

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
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.

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

16 December 2020

image/gif

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current13:26, 16 December 2020Thumbnail for version as of 13:26, 16 December 2020800 × 800 (2.26 MB)MornUploaded own work with UploadWizard
The following pages on the English Wikipedia use this file (pages on other projects are not listed):