GitXplorerGitXplorer
g

sgflib

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Unverified
f2ceb02d0f724beceba67842cfe494ffb7660238

updated

ggoodger committed 2 years ago
Unverified
02726921f5d86bbc82f5954760126599e413b9d0

Added list format output to Summary. Changed ''.format() to f''. Updated comments.

ggoodger committed 2 years ago
Unverified
30d158d2dd9735f837d7abc677e466ef33797ee7

Enable auto self-test.

ggoodger committed 2 years ago
Unverified
88198f4fa253f34f64e359c8081b88648cc7e7e2

Added --in-place/-i option to sgfnorm. Added mutually exclusive options support to CLI. Fixed bug around --uncomment setting in sgfnorm.

ggoodger committed 3 years ago
Unverified
24221c41f5ce15befc67fb425eabea6069976f84

Update to current codebase

ggoodger committed 3 years ago
Unverified
4be84b596f1b947b8bc28934a49d500f23fa2b6a

Update to current codebase

ggoodger committed 3 years ago

README

The README file for this repository.

====================================================== sgflib: Smart Game Format Parser Library & Utilities

Description

For Python programmers, sgflib.py is a module containing a parser and classes for SGF, the Smart Game Format, specifically for the game of Go.

For Go players, several utilities are included:

  • sgfmerge: Merge two or more game record files into one. Works best when the game record files are for the same game, and contain variations.

  • sgfnorm: Normalize an SGF file. Usful for comparing two files representing the same game.

  • sgfsummary: Read, analyze, and summarize one or more SGF files.

Installation

You'll need the Python language itself, version 3.8 or higher, freely available from http://www.python.org.

The sgflib.tgz archive contains the following:

  • sgflib.py -- SGF Parser Library. Put this in a folder on Python's path.

  • sgfsummary, sgfnorm, sgfmerge -- Utility tools. Put these on your PATH.

  • README.txt -- Installation instructions (the file you're reading now).

  • test_sgflib.py & test_data/ -- Test suite. Requires pytest to run.

Bugs & Other Issues

If you have any trouble running this code, if you find (maybe fix?) any bugs, or add any features, please contact_ the author.

To Do

  • Reimplement the GameTree as a data structure that's convenient for the user of sgflib, rather than following the file format.

  • Reimplement the Cursor class? Or remove it altogether if unnecessary.

  • Reimplement the parser?

    • Simplify. It works, but it seems clunky. Written early in my Python career.

    • Reimplement as a generator?

    • Support earlier versions of SGF?

  • Titler: Populate the title (GN/game_name property) inside the SGF file itself, e.g.:

    player1 (2 dan, white) vs player2 (4 kyu, black +h5); W+18½; KGS; 2020-12-04
    
  • Renamer: Rename SGF files, e.g.:

    2020-12-04 player1 · player2 +h5 W+18.sgf
    
  • Query SGF data: Extract game & node properties & comments from .sgf files. Queries could be Python expressions for maximum flexibility.

  • Handicap convertor? Lizzie (Leela Zero?) can't handle handicap stones, so this program would convert the HA[n] & AB[xx] tags to B[xx] moves & W[] passes. Katago via KaTrain doesn't have this problem though.

  • Auto-label variations.

Have any suggestions? Want to help? Please contact_ the author.

Contact

Project author: David Goodger <mailto:goodger@python.org>_.

Go Tools Project website: http://gotools.sourceforge.net.