Difference between revisions of "Python-chess"
Line 11: | Line 11: | ||
See [https://github.com/WolfgangFahl/play-chess-with-a-webcam/issues/19 Play Chess With a Webcam Issue 'Detecting Moves by a WebCAM'] for how the terms below might be used. | See [https://github.com/WolfgangFahl/play-chess-with-a-webcam/issues/19 Play Chess With a Webcam Issue 'Detecting Moves by a WebCAM'] for how the terms below might be used. | ||
== AN Algebraic Notation == | == AN Algebraic Notation == | ||
− | The [https://en.wikipedia.org/wiki/Algebraic_notation_(chess) Algebraic Notation] describes moves on the chessboard by giving each field a name e.g. "a2" and thus allow to describe from which field e.g. "a2" to which other field e.g. " | + | The [https://en.wikipedia.org/wiki/Algebraic_notation_(chess) Algebraic Notation] describes moves on the chessboard by giving each field a name e.g. "a2" and thus allow to describe from which field e.g. "a2" to which other field e.g. "a4" a move has been performed. |
+ | |||
+ | Example a2 a4 move: | ||
<html> | <html> | ||
<iframe src="https://lichess.org/embed/AbwZfoMz#1?theme=auto&bg=auto" | <iframe src="https://lichess.org/embed/AbwZfoMz#1?theme=auto&bg=auto" |
Revision as of 07:47, 27 December 2019
Click here to comment see PlayChessWithAWebCam
python-chess is a pure Python chess library with move generation, move validation and support for common formats. It is open sourced at https://github.com/niklasf/python-chess
Based on a request for more detailed documentation this page gives some more details.
Documentation
Glossary
See Play Chess With a Webcam Issue 'Detecting Moves by a WebCAM' for how the terms below might be used.
AN Algebraic Notation
The Algebraic Notation describes moves on the chessboard by giving each field a name e.g. "a2" and thus allow to describe from which field e.g. "a2" to which other field e.g. "a4" a move has been performed.
Example a2 a4 move:
FEN Forsyth–Edwards Notation
The Forsyth–Edwards Notation describes a board position.
Examples:
Given a FEN you can continue playing from that position. E.g given 8/5k2/8/5K1P/8/8/8/8
a game might continue as:
PGN Portable Game Notation
The Portable Game Notation is used to record the course of a game for others to follow or replay.
Example:
[Event "Play Chess With a WebCam"] [Site "Willich, Germany"] [Date "2019-12-21 12:46:49"] [Round "1"] [White "Wolfgang"] [Black "Maria"] [Result "1-0"] 1. e4 e5 2. Bc4 Nc6 3. Qh5 Nf6 4. Qxf7# 1-0
If you paste the above PGN into https://lichess.org/paste you'll get the following result:
See also http://lichess.bitplan.com