python-shogi
python-shogi copied to clipboard
Fixed yuiseki's svg renderer
Overview
- Completed the svg renderer to work properly.
- Created a simple unit test file to check validity.
Potential Improvements
- size scaling of pieces.
- improve numbering text for pieces on hand.
- not all pieces are perfectly central.
Example
import shogi
b = shogi.Board('4+R3l/1r1+P2gk1/3p1p1s1/2pg3pp/1p4p2/SP4PPP/2NP1PKS1/2G2+n3/8L w B2N2L3Pbgsp 10')
with open('svg_test.svg', 'w') as tfile:
print(b.svg(), file=tfile)
Any comments welcome!
@DerAndereJohannes Thank you for making your pull request based on the work of @yuiseki .
@yuiseki I've heard the license of the koma SVGs are Creative Commons BY-SA License
. Where is the source url you fetched the SVGs?
@gunyarakun I've copied those koma SVGs from this repository and merged it at SVG.py as definition of SGV. https://github.com/orangain/shogi-piece-images/tree/master/dist
It seems originally work is series of contribute for wikipedia. https://commons.wikimedia.org/wiki/File:Shogi_kinsho(svg).svg https://commons.wikimedia.org/wiki/File:Shogi_ginsho(svg).svg
I've already contain those license information to SVG.py
CC BY-SA 4.0 is compatible with GPLv3, but those SVG is licensed under CC BY-SA 3.0, So license matter isn't be simple... https://creativecommons.org/2015/10/08/cc-by-sa-4-0-now-one-way-compatible-with-gplv3/
I'm thinking one of solution to this license problem: Separate shogi.svg file as independent file and license only it as CC BY-SA 3.0 then read it from SVG.py
Coverage decreased (-4.7%) to 77.771% when pulling 52afb4d23c42be55c0ebfa282b84f09ccfe97aa7 on DerAndereJohannes:add-svg-renderer into 2f4d6d9219c35a2b94fcdede26883f2804c2cfd3 on gunyarakun:master.
I added the svg image and some more test code into the README! (the :align: center did not really work though..) I found another bug too when a player has more than 9 of a piece in their hand and fixed it!
Should we proceed with the yuiseki's idea of keeping the svg file separate with the other lisence? Is this legally possible? If it is then I think it is also the correct solution
I forgot to write my thought.
I guess the best way is not putting SVG files in this repository but write an instruction to fetch SVG files in README.md and user can pass the place of SVG files through an argument of svg()
.