ECO Utilities

A Wrapper for Encyclopaedia of Chess Openings (ECO) (see fiekas.eco) It makes use of polyglot books to arrange the games.

class eco.TSVType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Columns of TSV-files

class eco.ECODatabase(ecoDirectory: PathLike = 'C:\\Users\\Reinh\\OneDrive\\Dokumente\\python\\MzChess\\MzChess\\eco', tsvPattern: str | None = '*.tsv')[source]

A Wrapper class for Encyclopaedia of Chess Openings (ECO)

Parameters:
  • ecoDirectory – directory of tsv - files

  • tsvPattern – a glob pattern describing the files to be loaded. None -> nothing is loaded

__init__(ecoDirectory: PathLike = 'C:\\Users\\Reinh\\OneDrive\\Dokumente\\python\\MzChess\\MzChess\\eco', tsvPattern: str | None = '*.tsv') None[source]
loadTSVFile(tsvFile: PathLike) None[source]

Adds a tsvFile to the database

Parameters:

tsvFile – tsv - file to be added

statistics(key: TSVType = TSVType.ECO) Dict[str, Dict[str, int | List[int]]][source]

Delivers statistical data. key one of the 4 columns of a TSV-file, i.e.

  • ECO : eco code

  • OPENING : opening name

  • FEN : Forsyth-Edwards-Notation of the starting position

  • MOVES : move list

The values of the returned dictionary are

  • idList : list of entries in the TSV table

  • nItems : len(idlist)

  • nCommon : number of common moves

Parameters:

key – column of a TSV-file (see above)

Returns:

return dictionary

createGame(listOfFirstMoves: List[Move], polyglotBook: MemoryMappedReader | None = None) Game[source]

Creates a opening game starting with listOfFirstMoves. The opening variants are implemented as variants

Parameters:
  • listOfFirstMoves – list of starting moves

  • polyglotBook – if present, the moves are sorted with respect to frequency of use

Returns:

return dictionary