Skip to content

Conversation

@DerAndereJohannes
Copy link
Contributor

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)

complex_board

Any comments welcome!

yuiseki and others added 4 commits October 5, 2020 15:43
- added support for the promoted pieces
- shifted some values for the pieces in hand
- altered shadow drop
- check pieces for initial board position
- check pieces for complex board position
@gunyarakun gunyarakun mentioned this pull request Feb 25, 2021
@gunyarakun
Copy link
Owner

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

.. code:: python
>>> print(board.svg())
<svg>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if we could embed a real image generated by the command board.svg().
But I know it's not easy.

Copy link
Owner

@gunyarakun gunyarakun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gunyarakun
Copy link
Owner

@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
Copy link

yuiseki commented Feb 26, 2021

@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
Copy link

yuiseki commented Feb 26, 2021

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

- quantity would be overwritten with the second digit of the number
ie. if sente has 12 pawns, the svg would say he has 2 pawns
- to fix, changed the quantity to a string and converted to int
before using the value
- added file saving example for both python 2.7 and 3
@coveralls
Copy link

coveralls commented Feb 27, 2021

Coverage Status

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

@DerAndereJohannes
Copy link
Contributor Author

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
Copy link
Owner

gunyarakun commented Apr 3, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants