Chess Board¶
The use of the chessboard requires a mouse or a mousepad. A piece is moved like that:
mouse-left-press: begin move of selected piece
mouse-left-release: end move
For training purposes, several helpers are available.
Warn of Danger¶
The Warn of Danger is enabled by the Game/Warn of Danger
action.
It runs as follows:
assign material scores to each attack and reply for every ply
create a combined list of attacks and replies (cheapest first)
create a list of total scores for every ply
Effect on other pieces like discovered check are not considered. An example:
Obviously, the rook at b8
is danger.
Move Options¶
The Move Options are enabled by the Game/Show Move Options
action.
By pressing the left mouse button at b8
, we see:
It seem that b8-d8
is the best move, but it is dubious …
- class qboardviewclass.QBoardViewClass(parent=None)[source]¶
The chessboard is based on Qt’s QGraphicsView.
- setup(notifyNewGameNodeSignal: pyqtSignal | None = None, notifyGameNodeSelectedSignal: pyqtSignal | None = None, materialLabel: QLabel | None = None, squareLabel: QLabel | None = None, turnFrame: QFrame | None = None, hintLabel: QLabel | None = None, flipped: bool = False) None [source]¶
Set up of the game editor
- Parameters:
notifyNewGameNodeSignal – signal to be emitted if a move is added
notifyGameNodeSelectedSignal – signal to be emitted if a game node is selected
materialLabel – label showing the material budget
squareLabel – label showing the square under mouse pointer (usually in the status bar)
turnFrame – frame showing the color of player making the move
hintLabel – label showing the engine’s hints and scores (usually in the status bar)
flipped – if True, the square a1 is on top
- setHint(enableHint: int = 0, enableScore: bool = False, engine: ChessEngine | None = None) None [source]¶
Controls the usage of the hint label
- Parameters:
enableHint – If True, the hintLabel shows the engine hint
enableScore – If True, the hintLabel shows the engine scores
engine – engine to be used (required, if enableHint or enableScore
- setFlipped(enable: bool) None [source]¶
Controls the board orientation
- Parameters:
enable – if True, the square a1 is on top
- setDrawOptions(enable: bool) None [source]¶
Controls the draw options. Draw options are shown when mouse-left-press on a piece
- Parameters:
enable – if True, the draw options are enabled
- setWarnOfDanger(enable: bool) None [source]¶
Controls the warn of danger, i.e. shows attacked pieces
- Parameters:
enable – if True, the warn of danger is enabled
- set_fen(fen: str) None [source]¶
Configures the chessboard
- Parameters:
fen – position in Forsyth-Edwards Notation .. _Forsyth-Edwards: https://github.com/fsmosca/PGN-Standard