; Created in LibreOffice 4 with this LibreLogo program (+object to path conversion
; of FreeSerif chess figures of the final SVG by Inkscape for Wikipedia SVG rendering)
; Usage: Put this code into an English language document in LibO Writer,
; and click on the Start icon of the View»Toolbars»Logo toolbar.
; requested chess font: http://mip.noekeon.org/HTMLTTChess/chess_merida_unicode.html
; for other setup, positions, modify the arguments of the chess call in the end of the file
GLOBAL COLORS, FIX_SVG_EXPORT
COLORS = [0xe8ab6f, 0xffce9e, 0xd18b47]
FIX_SVG_EXPORT = 4pt ; set zero for other usage
TO setcolor p1 p2
IF p2 > 5 [ p2 = p1 + -p2 ] [ p2 = p1 + p2 ]
FILLCOLOR COLORS[p2%3]
END
TO hexagon s
p = POSITION
H = HEADING
PENUP LEFT 30 FORWARD s LEFT 120 PENDOWN
PENCOLOR “INVISIBLE”
REPEAT 6 [ FORWARD s LEFT 60 ] FILL
PENUP POSITION p HEADING H
END
HOME CLEARSCREEN PENUP POSITION [75, PAGESIZE[1]/2]
PENJOINT “MITER” HIDETURTLE
TO label2 s
FONTFAMILY “Nimbus Sans L”
FONTSIZE 25
h = HEADING
HEADING 0
LABEL s
HEADING h
END
TO chess white black
PENCOLOR “BLACK” PENDOWN RIGHT 60
FILLCOLOR “INVISIBLE” PENSIZE 4
REPEAT 2 [ ; outer border
REPEAT 6 [ FORWARD 25 RIGHT 60
REPEAT 5 [ FORWARD 25 LEFT 60 FORWARD 25 RIGHT 60 ]
] FILL FILLCOLOR COLORS[1] PENSIZE 0 ; only outer border
]
PENUP FORWARD 25 LEFT 120 FORWARD 25 HEADING 0
data = {“K”: “♔♚”, “Q”: “♕♛”, “R”: “♖♜”, “B”: “♗♝”, “N”: “♘♞”, “ ”: “♙♟”}
HEADING 0 RIGHT 120
n = 0
figures = white + “ ” + black + “ ”
FOR i IN RANGE 0 12 [
FOR j IN RANGE n 13-n [
setcolor i j
IF j = 6 [ LEFT 60 ]
IF i > 0 AND j > n AND j < 12 - n [ hexagon 25 ] [
FILLCOLOR “INVISIBLE” CIRCLE 50 ; for correct SVG clipping
IF i > 0 [ label2 STR i ]
]
p = “%s%d ” % (“abcdefghiklx”[j-1], i)
what = figures.find(p)
IF what > -1 [
FONTFAMILY “Chess Merida Unicode”
FONTSIZE 35
H = HEADING
HEADING 0 FORWARD FIX_SVG_EXPORT
k = data[(“ ” + figures)[what]]
FONTCOLOR “WHITE”
LABEL k[2]
FONTCOLOR “BLACK”
LABEL k[what > COUNT WHITE]
BACK FIX_SVG_EXPORT HEADING H
]
IF i = 0 AND j > 0 AND j < 13 [
l = “ abcdefghikl ”[j]
label2 l
]
PENUP LEFT 30 FORWARD 25 RIGHT 60 FORWARD 25 LEFT 30
]
PENUP RIGHT 30
IF i < 6 [ BACK 19 * 25 RIGHT 60 BACK 25 LEFT 30 ] [
BACK (18 – 3 * n) * 25 RIGHT 30
n = n + 1
]
]
END
PICTURE “hexagonal_chess.svg” [
chess “Kg1 Qe1 Rc1 Ri1 Nd1 Nh1 Bf1 Bf2 Bf3 b1 c2 d3 e4 f5 g4 h3 i2 k1” “Kg10 Qe10 Rc8 Ri8 Nd9 Nh9 Bf9 Bf10 Bf11 b7 c7 d7 e7 f7 g7 h7 i7 k7”
]
Licensing
I, the copyright holder of this work, hereby publish it under the following license:
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