Skip to content

Commit

Permalink
Merge pull request #35 from gbtami/pychess-makruk-fix
Browse files Browse the repository at this point in the history
Preserve promoted met sign
  • Loading branch information
gbtami authored Apr 25, 2024
2 parents 4938027 + b7239dd commit d5b1058
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion json2epd.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def generate_fens(json_file, stream, variant, count):
if variant not in sf.variants():
raise Exception("Unsupported variant: {}".format(variant))

show_promoted = variant in ("makruk", "makpong", "cambodian")
sfen = False

with open(json_file, "r") as f:
games = json.load(f)
cnt = 0
Expand All @@ -46,7 +49,7 @@ def generate_fens(json_file, stream, variant, count):
start_fen = sf.start_fen(variant)

for i in range(1, len(moves)):
fen = sf.get_fen(variant, start_fen, moves[:i], is960)
fen = sf.get_fen(variant, start_fen, moves[:i], is960, sfen, show_promoted)
stream.write(
"{};variant {};site https://www.pychess.org/{}{}".format(
fen, variant, _id, os.linesep
Expand Down

0 comments on commit d5b1058

Please sign in to comment.