Chess+Game

toc =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. 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.
 * Home * Chess * Game**
 * [[image:ChessIsenburgII20150928.jpg]] ||~  || 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. ||
 * A Game of 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. > Portable Game Notation  =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 :
 * Algebraic Chess Notation
 * Game Notation
 * Move List
 * 1) Event (the name of the tournament or match event)
 * 2) Site (the location of the event)
 * 3) Date (the starting date of the game)
 * 4) Round (the playing round ordinal of the game)
 * 5) White (the player of the white pieces)
 * 6) Black (the player of the black pieces)
 * 7) 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.

=MVC= include page="MVC to include"  =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. code format="cpp" 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"; code

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=
 * [|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

=External Links= > media type="youtube" key="Km024eldY1A"
 * [|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

=References= =What links here?= include page="Chess Game" component="backlinks" limit="120"
 * Up one Level**