[TOP-BANNER]
Home CV Publications PhD PostDoc SIMD
Android Glass Astronomy Retro Games Lego

UCI and XBoard Protocols for Android

UCI engine on Aart's Nexus One (complete 3-4-5-piece Nalimov on 8GB SD card)
[HTC]
Chess for Android is a chess application for the Android platform that supports the Universal Chess Interface (UCI) and Chess Engine Communication Protocol (often simply called the XBoard or WinBoard protocol). This feature allows replacing the built-in Java chess engine with more powerful third party engines. Users can either play an imported engine directly, use infinite analysis to study games, or even run tournaments between engines (see e.g. Android chess engines tournaments). This page gives some background on the feature. Instructions can be found in the manual.

UCI and XBoard

The Universal Chess Interface (UCI) was designed by Stefan Meyer-Kahlen and Rudolf Huber as an open interface between a chess engine and a chess GUI. The interface allows chess programmers to focus on writing the chess engine, leaving details such as board setup and play, clock and notation display, and possibly opening book and root-level endgame tablebases play to the GUI. Examples of programs on Windows, Linux, and Mac OS with UCI engine support are Arena, ChessBase Fritz, Lucas Chess, and Sigma Chess. In August 2010, Chess for Android was the first program that introduced UCI support on the Android platform.

The Chess Engine Communication Protocol (often simply called the XBoard or WinBoard protocol), designed by Tim Mann and H.G.Muller, provides an alternative protocol between chess engines and a chess GUI. In October 2011, Chess for Android was also the first program that introduced XBoard protocol on the Android platform.

Android Development

Applications for the Android platform (mainly ARM-based devices, although x86-based devices are emerging as well) can be developed in several ways.

(1) Most development for Android is done using the Android SDK and the Java programming language. An application is compiled into bytecode that used to run on the Dalvik Virtual Machine or, from Android 5.0 (Lollipop) forward, on ART (Android RunTime), making this approach the most portable (it runs on ARM and x86, as well as on possible future architectures). Because bytecode interpretation has lower performance than native code, Android 2.2 (Froyo) introduced the Dalvik JIT compiler, which translates bytecode into native code right before execution for a speed boost. Since then ART has replaced this with an optimizing AOT/JIT compiler. The Chess for Android GUI and its built-in engine are implemented using this first approach, and ship as a single package.

(2) Alternatively, developers that want higher performance can use the Android NDK to write performance-critical portions in C/C++, which is compiled into native code (ARM and/or x86). Those native components are then embedded through JNI in a regular Android application that is developed with the SDK. In this second approach, the bytecode and native components still ship as a single package.

(3) Finally, developers can do all development in C/C++ and generate stand-alone native code using the appropriate compiler toolchain (e.g. CodeSourcery for ARM or the toolchain that ships with the NDK). This third approach is used by Chess for Android to import engines that do not ship with the application. Users can first get Chess for Android from the Google Play, and later install third party engines from any other (possibly private) source.

UCI and XBoard Engines for Android

Although Chess for Android runs on any Android device, it is important that the engine has been compiled into proper native code for that device. Currently, the Android platform distinguishes between x86-based devices and ARM-based devices. Any engine binary that has been compiled for 32-bit x86 Linux will work for x86 Android as well. This format is widely available for many chess engines. Engine binaries compiled for ARM are not as widespread yet, although the list is growing. Some examples are given below.

[CHESS_ENGINE_TOUR] [CHESS_ENGINE_TOUR]

Importing UCI and XBoard Engines in Chess for Android

Before UCI and XBoard engines can be imported in Chess for Android, they first must be installed in internal memory as follows (Android Chessbase compatible engines, such as in the Android Chess Engines Package, do not need this step; such engines are directly available for import):

To actually import an engine in Chess for Android for game play, go to the UCI and XBoard submenu again, but now pick Import Engine and select the appropriate engine from the list of installed engines. If the import is successful, a window pops up with the engine name and author to indicate that the built-in Java chess engine now has been replaced by the imported engine (exiting the application unloads the engine). Some screenshots are shown below. Also see the Chess for Android Manual.

[UCI0] [UCI1] [UCI2] [UCI3] [UCI4] [UCI5]

[Google+] [GooglePlay] [LinkedIn] [Blogger] [YouTube]