Jump to content

File:Through the Looking-Glass chess game.gif

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia

Original file (800 × 800 pixels, file size: 650 KB, MIME type: image/gif, looped, 20 frames, 30 s)

Summary

Description
English: Chess game from Lewis Carroll's novel Through the Looking-Glass
Date
Source Own work
Author Morn
GIF development
InfoField
 
This GIF graphic was created with Python.
Source code
InfoField

Python code

Source code
#!/usr/bin/env python3

import os
import chess, chess.svg

game = (
"6n1/8/2K5/5N2/4k3/8/3Pq3/2Q2R2 b - - 0 1",
"6n1/8/2K5/5N1q/4k3/8/3P4/2Q2R2 w - - 1 2",
"6n1/8/2K5/5N1q/3Pk3/8/8/2Q2R2 b - - 0 2",
"6n1/8/2K5/5N1q/2QPk3/8/8/5R2 b - - 0 2",
"6n1/8/2K5/2Q2N1q/3Pk3/8/8/5R2 b - - 0 2",
"6n1/8/2K5/2QP1N1q/4k3/8/8/5R2 b - - 0 2",
"5Qn1/8/2K5/3P1N1q/4k3/8/8/5R2 b - - 1 2",
"5Qn1/8/2KP4/5N1q/4k3/8/8/5R2 b - - 0 2",
"2Q3n1/8/2KP4/5N1q/4k3/8/8/5R2 b - - 1 2",
"2Q3n1/3P4/2K5/5N1q/4k3/8/8/5R2 b - - 0 2",
"2Q5/3Pn3/2K5/5N1q/4k3/8/8/5R2 w - - 1 3",
"2Q5/3PN3/2K5/7q/4k3/8/8/5R2 b - - 0 3",
"2Q5/3P4/2K5/5N1q/4k3/8/8/5R2 b - - 1 3",
"2QQ4/8/2K5/5N1q/4k3/8/8/5R2 b - - 0 3",
"2QQq3/8/2K5/5N2/4k3/8/8/5R2 w - - 1 4",
"3Qq3/8/Q1K5/5N2/4k3/8/8/5R2 w - - 1 4",
"4Q3/8/Q1K5/5N2/4k3/8/8/5R2 b - - 0 4",
)

arrows = (
(chess.E2, chess.H5),
(chess.D2, chess.D4),
(chess.C1, chess.C4),
(chess.C4, chess.C5),
(chess.D4, chess.D5),
(chess.C5, chess.F8),
(chess.D5, chess.D6),
(chess.F8, chess.C8),
(chess.D6, chess.D7),
(chess.G8, chess.E7),
(chess.F5, chess.E7),
(chess.E7, chess.F5),
(chess.D7, chess.D8),
(chess.H5, chess.E8),
(chess.C8, chess.A6),
(chess.D8, chess.E8),
)

def svg(i):
    board = chess.Board(game[i - 1])
    if i > 1:
        a = [arrows[i - 2]]
    else:
        a = []
    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 range(len(game)):
    svg(i)
    i += 1


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

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

17 May 2021

665,918 byte

800 pixel

800 pixel

image/gif

67975135a427914c8f6c150e2bb65fe0c41003d9

File history

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

Date/TimeThumbnailDimensionsUserComment
current14:24, 17 May 2021Thumbnail for version as of 14:24, 17 May 2021800 × 800 (650 KB)MornUploaded own work with UploadWizard

The following page uses this file: