gunyarakun / python-shogi

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

Feature: Allow for custom starting boards through kif files (Issue #24) - fix #38

Closed DerAndereJohannes closed 3 years ago

DerAndereJohannes commented 3 years ago

this is the same as the previous pull request, but from a better starting position. I hope this will resolve any conflicts smoothly.

Feature description

Addition to the kif parser that imports the custom starting board as sfen (perfect for tsume problems) as discussed in issue #24 .

Need help with some information:

as of right now, i have that the custom sfen uses the current_turn variable as whos turn it is and just the number 1 as turn number. Is this the correct way of doing it? In other words, what should the turn variable and the move variable be for the sfen? Either:

  1. turn = 'b', move = 1 to signify the start of the game
  2. turn = current_turn, move = len(moves) to signify where the game will be after using all the moves

Thanks in advance!

coveralls commented 3 years ago

Coverage Status

Coverage increased (+0.8%) to 83.301% when pulling 1a92efb03a4566681094ebb4d99ae70883143a65 on DerAndereJohannes:custom-kif into 2f4d6d9219c35a2b94fcdede26883f2804c2cfd3 on gunyarakun:master.

gunyarakun commented 3 years ago

@DerAndereJohannes Awesome work! I'll merge this.

gunyarakun commented 3 years ago

I've released python-shogi v1.0.13 including this pull request. https://pypi.org/project/python-shogi/1.0.13/

gunyarakun commented 3 years ago

There are some test failures on Python 2.7 and 3.5. https://travis-ci.org/github/gunyarakun/python-shogi This is because Python introduces a new dict structure on Python 3.6 and that changes the order of iterating dict items.

I don't think this is critical. Let me adding sorting keys.