Entering Moves

From Chessprogramming wiki
Jump to: navigation, search

Home * User Interface * Entering Moves

Alex Bernstein entering moves into the IBM 704 console, 1958 [1]

Entering Moves is the user's primary input while interacting with the chess program during game play, to make a move. Chess engines using a command line interface may rely on external chess user interfaces or GUIs and their protocols without dealing with possible ambiguous and order dependent user interactions while entering moves, and receive moves in a defined notation via a standard input stream. The Chess Engine Communication Protocol and the Universal Chess Interface both use simple to parse pure algebraic coordinate notation [2]. XBoard version 2 has the option to switch on SAN. Entering moves inside an event driven GUI, more intuitive for the casual user not familiar with chess coordinates, requires more effort for the GUI programmer.


In a sequential command line interface the chess program prompts for input. Unless redirected, input is expected from the keyboard. In CLI, text input is usually buffered and echoed by the operating system until the user confirms it by pressing the enter- or return key, causing the OS to transfer the whole text line via standard streams to the program.

The user has to type in his move according to the syntax or notation the program or GUI understands, most common pure algebraic coordinate notation as used in the Chess Engine Communication Protocol and the Universal Chess Interface, that is:

<move notation> ::= <from square><to square>[<promoted to>]
<square>        ::= <file letter><rank number>
<file letter>   ::= 'a'|'b'|'c'|'d'|'e'|'f'|'g'|'h'
<rank number>   ::= '1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'
<promoted to>   ::= 'q'|'r'|'b'|'n'

A from-to delimiter, a dash, hyphen or space for quiet moves or 'x' or colon for captures, is usually omitted and may only used in a notation window to make it easier to read for humans. Castles are given by king from-to coordinates ('e1g1', 'e1c1') or its own syntax of 'O-O' or 'O-O-O', also required for Chess960.


Event driven graphical user interfaces allow more flexible interactions to enter moves. While this is more user friendly, it is more effort for the GUI programmer, due to the implementation of a finite state machine for various states, modes and actions of a sequence of move entering interactions by a pointing device and/or keyboard, considering possible different focus windows like board window, notation window or a dedicated CLI-like command window or form, and also focus changes.

Board Interactions


The "natural" way to enter moves, similar to the interactions of a real chessboard, is drag-and-drop with the pointing device, also emulated by the keyboard. The user first selects the piece on its departure square, grabs it by clicking a device button, to drag it to the destination square, where the button is released to drop the piece. Another pointing device alternative without dragging is to select both squares in any order. A drag-and-drop or click-click keyboard simulation would require a square cursor, navigated by arrow keys and/or entering square coordinates (file letter and rank number in any order), and for instance the space key to grab and drop the piece.


Some GUIs support casual players by indicating all possible destination squares after selecting the piece, or the other way around, after first selecting a destination square, highlighting all pieces on the board which may move to that square.


Aart Bik's Chess for Android, selecting f3 shows all queen targets highlighted [3]

Advanced modes for ambitious Blitz players may already confirm the move entering interaction, if only one piece can move to a selected destination square, or if a selected piece has only one move. Similar is possible for moves that seem plausible according to some move entering heuristics, for instance Heumas (Heuristic Move Assistant - developed by Chrilly Donninger [4] ), as used in ChessBase or Fritz GUI [5] .


Promotions require the additional interaction to chose a piece, which might be implemented via a menu popping up on the promotion square, temporarily grabbing the keyboard focus - or similar, but slightly less comfortable, using a modal dialog with a small list box or four radio-buttons and an OK button to confirm, in all cases queening as default. Entering a piece letter should be appropriate as well to finish the sequence of move entering interactions.

Move List Interactions

If the notation window has the keyboard focus, pressing a none control key may activate a text box to enter moves in various notations like pure algebraic coordinates, LAN or SAN. Further, a Content assist or combo box may list all possible moves, where the user may choose one.

Dedicated Chess Computers

Dedicated Chess Computers have their own move entering systems, the board computers likely sensory boards with pressure-sensitive switches or piece recognition. Small chess computers often have a dedicated coordinate keyboard, eight keys to enter file and rank in context of from- and then to-square.


Elektor Chess Computer with Micro-Max inside [6]

More minimalistic systems, like Harm Geert Muller's Matchbox Usurpator [7] [8] , even managed move input with only one switch and some mode feedback from the display.

Computer Vision

Chess playing Robots may recognize the moves their (human) opponents made on an ordinary chess board in a more sophisticated way by computer vision [9] and real-time video image processing.


While parsing move notations, especially SAN [10], it is handy to have a list of legal moves available for the current position the engine is pondering on. Programs may tolerate redundant, overdetermined from-square specifications in SAN like given by LAN, including dash or hyphen. Leading piece letters are supposed to be upper case, while file letters and promoted piece letters should be lower case characters.

See also


External Links


Up one Level