3

I am building a chess board where I have one LED for each column and row, so I can represent moves by iluminating the orogin coordinate (e2) and the destination coordinate (e4)

However chess algebraic notation is simplified and the origin and destination coordinates need additional info to be calculated (like the board and the rules for each piece)

I am looking for some library or function that does this convertion (any language is fine).

Basically I need this function to translate my board coordinates to a chess engine notation and viceversa.

2 Answers 2

4

Java: https://github.com/bhlangonijr/chesslib/tree/master/src/main/java/com/github/bhlangonijr/chesslib

C++: https://github.com/alexmdc/chesslib

Python: https://pypi.org/project/python-chess/

C: https://sourceforge.net/projects/sankit/

These are all able to return long algebraic notation. Stockfish is reported to also.

3

https://github.com/niklasf/python-chess

Parses and creates SAN representation of moves.

>>> board = chess.Board()
>>> board.san(chess.Move(chess.E2, chess.E4))
'e4'
>>> board.parse_san('Nf3')
Move.from_uci('g1f3')
>>> board.variation_san([chess.Move.from_uci(m) for m in ["e2e4", "e7e5", "g1f3"]])
'1. e4 e5 2. Nf3'

Do you see "g1f3" translates to Nf3?

1
  • thanks, I'll take a look and see if I can adapt it to my needs Jul 19, 2018 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.