Chess Game
The Game of Chess which is actually played (or analyzed) by a chess program via its user interface requires a game record, or game history, which is a list or array of moves or a tree of alternative move variants even containing comments. While the game record is necessary to take back moves f.i. after operator errors, the game history needs to be considered if it is about to claim or accepts draws by three fold repetitions, and might therefor be referred by the search algorithm as well.
Contents
Start of the Game
The game of chess starts with the initial position, white to move. Both sides alternately move their pieces until the game is finished.
End of the Game
There are three possible outcomes of the game, white wins (1-0), black wins (0-1) or draw (1/2-1/2). Unfinished games may be adjudicated, which was common until the 80s in computer chess tournaments, for instance the adjudicated win of Cray Blitz against Schach 2.7 during WCCC 1986 [2] . Checkmate and stalemate finish the game immediately. Other occurrences usually require communication with the opponent and admission or adjudication of an arbiter instance (i.e. Tournament director), which in computer chess requires a protocol and/or interaction, like claiming a threefold repetition draw in over the board computer chess.
see main article Rules of Chess
Win/Loss
Since chess is a Zero-sum game, the win of one player is the loss of the other player.
- Checkmate - if in check with an empty set of legal moves
- Loss on time
- Resignation (to resign)
Draw
The game of chess ends and is draw after either
- Stalemate - if not in check but no legal moves
- Correct threefold repetition claim
- Correct fifty-move rule claim
- Insufficient material
- Draw offer accepted
Game Record
Chess programs (not necessarily the pure (search) engine) keep track of all moves played in the game from the initial starting position stored inside a move list, often in conjunction with a list of Zobrist or BCH signatures of the up to 100 last reversible moves for the purpose to detect twofold or threefold repetitions.
Game Header
The game header keeps metadata of a game, such as player names, date of the game and site of the event and result. For instance, the PGN game header consists of a set of attribute value pairs. The so called Seven Tag Roster (STR) is mandatory [3]:
- Event (the name of the tournament or match event)
- Site (the location of the event)
- Date (the starting date of the game)
- Round (the playing round ordinal of the game)
- White (the player of the white pieces)
- Black (the player of the black pieces)
- Result (the result of the game)
Longest Game
In 1966, Eero Bonsdorff, Karl Fabel, and Olvai Riihimaa gave 5899 as the maximum number of moves in a chess game, considering the Fifty-move Rule [4] [5] [6].
MVC
The chess program and its user interface can be interpreted as a Model–view–controller (MVC), an architectural pattern that isolates business logic f.i. game administration, time management and searching a move inside a chess program from input and presentation. The game model represents the domain-specific data on which the application operates - Inside a chess program, the information about the initial position and the game record to reproduce the current positions, likely subject of search or pondering during game play. The model and controller implement a finite-state machine which controls the game, its states, state transitions and actions considering various modes. The view displays the game notation, a list of moves, and likely the board with the current position, suitable for interaction inside a user interface. The controller receives input from various sources and devices, such as keyboard, mouse, serial port and internet socket, and initiates a response by making calls on model objects.
The Game Loop
Early chess programs without Pondering used a simple sequential control structure to play the whole game for instance via a teleprinter or any Computer terminals in a sequential manner.
state := playGame; initialize position print board while (state != gameover) wait for input of a move by the user make move (if legal) if (mate or stalemate) { state := gameOver; break; } search move with allocated time make move print move and update board if (mate or stalemate) state := gameOver; } print "thank you for playing the game";
CLI
Most current chess engines communicate via a sequential command-line interface, available in all common operating systems. Pondering and the need to enter moves and commands even if the program is "thinking", requires a more complicated control structure and an interruptible search routine. Often engines used coroutines to implement internal context switching between search and user interaction. Today, it is more common to rely on multithreading abilities of recent operating systems, and to use an explicit I/O-thread, while the search routine is regularly pondering whether it needs to be interrupted by pending input received by another thread, with the option to asynchronous stop the search.
Event driven GUIs
With the advent of operating systems with graphical user interfaces, also encouraged by additional input devices such as a computer mouse for asynchronous user interaction, the embedding of a chess engine with a classical CLI inside the event-driven architecture of a graphical user interface became more difficult. Today, most programmers rely on external event driven graphical user interface applications using standard streams or pipelines to communicate with the GUI via protocols such as the Chess Engine Communication Protocol and the Universal Chess Interface. The external GUI application constitutes the MVC view and controller, and more or less even parts of a (redundant) game model (or even multi-game model), to make the GUI aware of its own game states to even make decisions on behalf of the engine, such as move selection from opening books and endgame tablebases, draw claims and offers and to finally declare the game over. These game interacting features of the external GUI application in conjunction with certain protocols such as UCI by far exceeds what a pure chess user interface was initially designed for - controller and view only, enter legal moves and render the state of the game, which has become disputed issue in playing official tournament games.
See also
- Board Representation
- Chess Engine Communication Protocol
- Chess Position
- Contempt Factor
- Graphical User Interface
- Match Statistics
- Pawn Advantage, Win Percentage, and Elo
- Strategy
- Tactics
- Time Management
- UCI
- User Interface
Publications
- Ingo Althöfer (1990). Compressing Chess Games with the Help of a fast Deterministic Chess Program. ICCA Journal, Vol. 13, No. 4
- Ingo Althöfer (1991): Data compression using an intelligent generator: The storage of chess games as an example. Artificial Intelligence, Vol. 52, No. 1
- Borko Bošković, Sašo Greiner, Janez Brest, Viljem Žumer (2005). The Representation of Chess Game. Proceedings of the 27th International Conference on Information Technology Interfaces
- Nick Pelling (2013). Chess Superminiatures. eBook, Kindle edition, Amazon
Forum Posts
2010 ...
- One billion random games by Steven Edwards, CCC, August 27, 2011
- One billion random games by Steven Edwards, CCC, July 03, 2013
- Revised source for the random game generator by Steven Edwards, CCC, May 12, 2015
- Random game mating probabilities by Steven Edwards, CCC, March 12, 2016
- This should be in the wiki by Steven Edwards, CCC, April 13, 2016 » Repetitions
- Photographing Chess Clock by Harm Geert Muller, CCC, October 10, 2016
- What can be said about 1 - 0 score? by Kai Laskos, CCC, March 28, 2017 » Match Statistics
2020 ...
- Open Chess Game Database Standard (OCGDB) by Nguyen Pham, CCC, October 20, 2021 » Chess Databases
External Links
- Game Of Chess
- Chess notation from Wikipedia
- Representation of Chess Game - Computer Architecture and Languages Laboratory, University of Maribor
- How many chess games are possible? by Dr James Grime, numberphile, YouTube Video [7]
References
- ↑ A Game of Chess in the Middle Ages, Image photographed from an explanation table labeled "Die Essener Isenburg" at the Isenburg Castle in Essen, Germany, by Gerd Isenberg, September 28, 2015
- ↑ Helmut Horacek, (1986) The Fifth World Computer Chess Championship Cologne, 1986, Research Unit for Information Science and Artificial Intelligence, University of Hamburg, from Kings move Welcome to the 1989 AGT World Computer Chess Championship. pg 21, pdf from The Computer History Museum
- ↑ Standard: Portable Game Notation Specification and Implementation Guide by Steven Edwards, 8.1.1: Seven Tag Roster
- ↑ Eero Bonsdorff, Karl Fabel, Olvai Riihimaa (1966) Schach und Zahl - Unterhaltsame Schachmathematik. Seite 11-13, Walter Rau Verlag, Düsseldorf (German)
- ↑ 50-Züge-Regel - Schachmathematik from Wikipedia.de (German)
- ↑ Defending Humanity's Honor by Tim Krabbé, see game NewRival - Faile with 493 moves, and playing 402 moves with bare kings!
- ↑ Claude Shannon, Shannon number, Godfrey Harold Hardy, A googolplex of Go games