wiki:WikiStart
Last modified 4 years ago Last modified on 01/03/16 23:19:34

Basic checkmate: King and rook (blind computer)

Summary

The program simulates chess endgame where computer put into checkmate a user in finite number of steps. This is the basic variant of checkmate where user's king faces the computer with king and rook. In order to make the problem more complicated, the computer does not know the position of the opponent's king, it may receive only these messages: Check, checkmate or inaccessible square.

Features

  • AI that always beats player (with exception, see Known Issues)
  • Randomly generated chessboard
  • Simple text GUI with history of every move
  • Syntax compliant with all main dialects: Free or Turbo Pascal, Object Pascal and (Borland) Delphi
  • No advance programming techniques like OOP, exceptions or reflection, only plain Pascal syntax
  • The program that does not use heap allocation

Requirements

Any compiler able to parse supported Pascal dialect. There is provided a configuration file of Free Pascal compiler and Lazarus project file.

Installation

To compile source code with Free Pascal Compiler, execute

    fpc [-dRELEASE] Checkmate.pas

for Release version and

    fpc -dDEBUG Checkmate.pas

for Debug version. To compile Lazarus project file use lazbuild tool:

    lazbuild Checkmate.lpi

The debug version needs to be compiled with additional flag:

    lazbuild --build-mode="Debug" Checkmate.lpi

Documentation

The program is controlled by keyboard. See Usage at start of the application.

Known Issues

The AI may fail to beat user at the very beginning of the game, where new chessboard is randomly generated. The user king may be everywhere and after the first move the rook of computer may not be protected by king.

Licensing

See LICENSE file.