Proposal for the construction of a chess-playing machine
Student: Joe Coffland
Supervising Professor: Dr. Amit Jain
January 24, 2000
Purpose: This document is a proposal to the Boise State University computer science department for the construction of a chess-playing machine as an independent study project. It is also a specification for the proposed project.
Scope: The chess-playing machine (to be referred to as CPM from here on) is a combination of a hardware and software interface to the gnu chess program. This machine will detect and report the movement of chess pieces made by a human user. It will also, via a movable electromagnet, move pieces on the board in response to the users moves. The user will be able to play chess against a computer opponent, but using a real chessboard. It is theorized that the human player will have a better chance at beating the computer when confronted with a tangible three-dimensional game. This project will not involve the development of any algorithms, which attempt to make decisions about chess strategy. The CPM will however check for correctness of the users moves, track the position of all chess pieces, and decide how to move pieces on the chess board without conflict.
Overview: The remainder of the document will give a general description of the CPM followed by a more detailed description of specific requirements. This specification may be revised as problems arise during the construction of the CPM.
Perspective: CPM is perhaps the wrong name for this project because alone the CPM will play no chess. It is truly a software and hardware interface between a human user and the gnu chess program. The CPM will utilize a personal computer capable of running the Linux operating system and the gnu chess program. Initial construction will make use of the parallel port to communicate between hardware and software portions of the CPM. If time and resources allow an adapter card version will also be constructed.
Functions: There are two main functions of the CPM. First the CPM must detect the movement of chess pieces on the board and decode these movements into a form acceptable for processing by the gnu chess program. Secondly it must translate the output of the gnu chess program into sequences of mechanical moves.
User characteristics: Use of this product should not require any special technical knowledge. Once running it should be usable by anyone capable of playing chess.
Assumptions and dependencies: The CPM will depend on the gnu chess program and the Linux operating system, but may be adapted for other chess programs and other operating systems.
Movement detection and reporting
Introduction: This requirement involves every aspect of processing the users movement of chess pieces to delivering a valid chess move to the gnu chess program.
Inputs: This functions inputs are detected by scanning the chess boards rows and columns at a high speed and comparing the scan results to those of previous scans.
Processing: Most of the processing will be performed within a microcontroller external to the PC. This controller will scan the chessboard as a matrix. Using a demultiplexer it will select a row of the chessboard and send a voltage down that row. If any chess pieces are on the row, the corresponding switch will be closed. The controller will then read each column, detecting pieces by the presence of voltage. To overcome the problems of bouncy switches the controller will only report changes that are present for several successive scans. Changes in the matrix will result in either an error or a successful chess move. An error may occur in the detection process if the user disobeys the rules of chess, but should not otherwise. When it is unclear how the user has moved the pieces, it will always be assumed that a valid move was maid. This may allow the user to confuse the CPM by castling incorrectly or by other malicious play.
Outputs: Upon detection of a valid move the controller will send this move via the parallel port to the software portion of the CPM which will in turn relay it to the gnu chess program.
Computer response processing
Introduction: This function covers all aspects of retrieving the gnu chess output to performing the required mechanical movements.
Inputs: All inputs to this function are received from the gnu chess program.
Processing: Once the gnu chess program has calculated its chess move, this move will be passed on to the microcontroller. The controller will then decide how the pieces on the board must be moved. When moving pieces such as the knight, pieces not involved in the actual move may first need to be moved out of the way and then back. The controller will process the chess move into possibly many non-colliding moves. These moves will then be further processed into instructions for the motors and electromagnet. During the time the motors are moving all scanning activity will be suspended.
Outputs: The net result of each pass of this function must be a valid chess move.
External interface requirements
User interfaces: The primary user interface will be the chessboard itself. Information such as whose turn it is will be conveyed to the user via LEDs on the board. In addition diagnostic information will be displayed to the user via the computer screen.
Hardware interfaces: The standard PS/2 parallel port interface will be used to communicate between the personal computer and the CPM microcontroller. Stepper motors will be used to discretize the electromagnet movements.
Software interfaces: The CPM will contain two software interfaces. The first interface will be to the parallel port and the second to the gnu chess program.
Performance requirements: The CPM must scan at least several hundred times a second so detection appears instantaneous to the user. A single chess move should take at most 30 seconds to complete, including the movements required for collision avoidance.
Standards compliance: The CPM will comply with USCF official chess rules and algebraic notation.
Hardware limitations: All functions will be limited by the processing power of the CPMs microcontroller. However current embedded processor speeds should far exceed the performance requirements.