gunyarakun / python-shogi

A pure Python shogi library with move generation and validation and handling of common formats.
GNU General Public License v3.0
181 stars 43 forks source link

Fixed yuiseki's svg renderer #36

Open DerAndereJohannes opened 3 years ago

DerAndereJohannes commented 3 years ago

Overview

Potential Improvements

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)

complex_board

Any comments welcome!

gunyarakun commented 3 years ago

@DerAndereJohannes Thank you for making your pull request based on the work of @yuiseki .

gunyarakun commented 3 years ago

@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?

yuiseki commented 3 years ago

@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/

yuiseki commented 3 years ago

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

coveralls commented 3 years ago

Coverage Status

Coverage decreased (-4.7%) to 77.771% when pulling 52afb4d23c42be55c0ebfa282b84f09ccfe97aa7 on DerAndereJohannes:add-svg-renderer into 2f4d6d9219c35a2b94fcdede26883f2804c2cfd3 on gunyarakun:master.

DerAndereJohannes commented 3 years ago

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

gunyarakun commented 3 years ago

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().