# El Ajedrecista

El Ajedrecista ([el axeðɾeˈθista], English: The Chess Player) is an automaton built in 1912 by Leonardo Torres Quevedo in Madrid,[2] one of the first autonomous machines capable of playing chess.[3] As opposed to the human-operated The Turk and Ajeeb, El Ajedrecista had a true integrated automation built to play chess without human guidance. It played an endgame with three chess pieces, automatically moving a white king and a rook to checkmate the black king moved by a human opponent.

The device could be considered the first computer game in history.[4] It created great excitement when it made its debut, at the University of Paris in 1914. It was first widely mentioned in Scientific American as "Torres and His Remarkable Automatic Devices" on November 6, 1915.[5] In 1951, El Ajedrecista defeated Savielly Tartakower at the Paris Cybernetic Congress, being the first Grandmaster to lose against a machine.[6]

The automaton does not deliver checkmate in the minimum number of moves, nor always within the 50 moves allotted by the fifty-move rule, because of the simple algorithm that calculates the moves. It did, however, checkmate the opponent every time.[7] If an illegal move was made by the opposite player, the automaton would signal it by turning on a light. If the opposing player made three illegal moves, the automaton would stop playing.[8]

## Technical description

Its internal construction was published by H. Vigneron.[8] The pieces had a metallic mesh at their base, which closed an electric circuit that encoded their position in the board. When the black king was moved by hand, an algorithm calculated and performed the next best move for the white player.[9]

Torres defined two zones for use in his algorithm, the first consisting of the a-, b-, and c-files, and the second consisting of the f-, g-, and h-files. The algorithm is as follows:[8]

If the black King

• is in the same zone as the rook
• then the rook moves away from the zone to either the a- or the h-file.
• is not in the same zone as the rook and the vertical distance between the black king and the rook is
• more than a square
• then the rook moves one square vertically towards the black king.
• one square, with the vertical distance between the two kings being
• more than two squares
• then the king moves one square vertically towards the black king.
• two squares, with the number of squares representing their horizontal distance apart being
• odd
• then if the rook is on the a- or h-file, it moves to the b- or g-file respectively, and vice versa.
• even
• then the white king moves one square horizontally towards the black king.
• zero
• then the rook moves one square vertically towards the black king.

Here is an example game where White, following Torres' algorithm, checkmates the black King, who performs the best defense according to a chess endgame tablebase, recorded in Portable Game Notation:

```[FEN "8/8/1k6/8/R7/8/5K2/8 w - - 0 1"]

1. Rh4 Kc5 2. Kf3 Kd5 3. Ke3 Kd6 4. Rh5 Kc6 5. Ke4 Kd6 6. Rg5 Kc6 7. Kd4 Kd6 8. Rg6+ Kd7 9. Kd5 Ke7 10. Rh6 Kf7 11. Ra6 Ke7 12. Rb6 Kf7 13. Ke5 Ke7 14. Rb7+ Kd8 15. Ke6 Kc8 16. Rh7 Kb8 17. Rg7 Ka8 18. Kd6 Kb8 19. Kc6 Ka8 20. Kb6 Kb8 21. Rg8#
```

In the first version, the pieces were plugged into the board, and the game states of check and checkmate were signaled with light bulbs.[3] Leonardo's son Gonzalo made an improved chess automaton based on El Ajedrecista in 1920, which made its moves via electromagnets located under the board.[10] It also included a sound effect, with a voice recording announcing checkmate when the computer won the game.[11]

Both are still working and are on display at the Museo Torres Quevedo in the Escuela de Ingenieros de Caminos, Canales y Puertos in Madrid.[12][13]

## Notes

1. ^ Gizycki, Jerzy. A History of Chess. London: Abbey Library, 1972. Print.
2. ^ Velasco, Juan Jesus (2014). "Leonardo Torres Quevedo, referente para la ingeniería y desconocido para el gran público".
3. ^ a b Williams, Andrew (2017-03-16). History of Digital Games: Developments in Art, Design and Interaction. CRC Press. ISBN 9781317503811.
4. ^ Montfort, Nick (2003). Twisty Little Passages: An Approach to Interactive Fiction. MIT Press. p. 76. ISBN 0-262-63318-3. In 1912 Leonardo Torres Quevedo ... devised the first computer game ... The machine played a KRK chess endgame, playing rook and king against a person playing a lone king.
5. ^ Torres and his remarkable automatic devices. Issue 2079 of Scientific American, 1915
6. ^ Hooper & Whyld 1992 page 22. The Oxford Companion to Chess (2nd ed.). England: Oxford University Press. ISBN 0-19-866164-9.
7. ^ Atkinson, George W. (1998). Chess and machine intuition. Intellect Books, pp. 21-22. ISBN 1-871516-44-7
8. ^ a b c H. Vigneron: Robots. English Translation in: David Levy, Monty Newborn: Chess and Computers, pp. 13-23. Computer Science Press, 1982.
9. ^ Velasco, JJ (2011-07-22). "Historia de la tecnología: El ajedrecista, el abuelo de Deep Blue". Hipertextual (in European Spanish). Retrieved 2017-08-14.
10. ^ Brian Randell, From Analytical Engine to Electronic Digital Computer: The Contributions of Ludgate, Torres and Bush. Annals of the History of Computing, Vol. 4, No. 4, Oct. 1982
11. ^ "Leonardo Torres Quevedo, referente para la ingeniería y desconocido para el gran público". eldiario.es (in Spanish). Retrieved 2017-08-14.
12. ^ "Universidad Politécnica de Madrid". www.upm.es (in Spanish). Retrieved 2017-08-16.
13. ^ "Torres y Quevedo's rook endgame automaton". Chess News. 2004-07-20. Retrieved 2017-08-16.