Posts

Showing posts with the label chess programming

Chess for Android: version 6.1.1

Image
I am gradually rolling out version 6.1.1 of Chess for Android to Google Play. Besides some internal cleanup and refactoring, the major new features are:
simple FICS client (see details at Connecting Chess for Android with FICS)improved electronic chessboard support (DGT/Certabo/Millennium)rudimentary DGT chess clock support (shows moves) The FICS interface is simple, in line with the design philosophy I have always followed so far.  Despite the simplicity, the client is fully functional, and I have started to enjoy playing online over an actual chessboard myself. Hopefully others will find the combination of an electronic chessboard and online play just as enjoyable!
A big thank you to my testers! Writing a client from scratch was a non-trivial task, and took a long time. Having awesome testers was extremely helpful during the initial development. Any remaining bugs are mine, of course. Please send me the details if you find one.

DGT 3000

Image
This beautiful DGT 3000 chess clock just arrived! I can't wait to start hacking and find out what features I can implement for Chess for Android connected to a DGT chess board and this clock. In particular,  am hopeful that the combination of online chess on FICS with an electronic chess board and clock will provide a very pleasant chess playing experience! 


Image
It took me a bit longer than planned, but I finally finished the alpha version of a FICS (Free Internet Chess Server) interface in Chess for Android. Either play directly on a phone or table, or first connect to an electronic chessboard (DGT, Certabo, and Millennium) to play over an actual chess board with people online.
To connect to FICS, long press the notation window in Chess for Android to open the extended menu. Then select "Connect to FICS" and login as a guest or using your register username and password. The formula string can be used to filter out match requests. For example time >= 5 & inc = 1 only accepts games with at least five minutes start time per player and exactly one second increment per move. The formula syntax is explained in more detail on the FICS help page.
Once connected, your username or temporary guest name is shown at the bottom of the screen. Match requests that pass the filter are shown in a dialog with the player names and game paramet…

Chess for Android Coding

Image
Around the holidays I am finally getting some spare time to implement new features for Chess for Android. I am actively "in the zone" working on:

The ability to offer a draw or resign during an ongoing game. Since the UCI protocol does not provide this feature, the GUI will accept the draw simply based on past evaluations of the position.The ability to change the users name and ELO rating, which will appear in the header for all user games that are saved in PGN format to the SD card.The ability to connect to FICS, the free internet service. This is of course the most work and currently still in prototype stage. The first release will probably start simple by just allowing to watch demo games.


Connecting with the DGT Board

Image
After all the fun I had connecting Chess for Android with the Millennium over Bluetooth, I was curious if I could provide similar support for the DGT electronic chess boards. Some of these have Bluetooth capabilities, most use USB connections, and some older models, like the one I have, still use the RS-232 connector.

To my pleasant surprise, by combining the original serial cable of DGT with a USB-to-serial cable and a female-USB-to-USB-C cable, I was able to get an actually working connection between my DGT board and my tablet or phone.

Next was implementing support in Chess for Android. Luckily, DGT kindly shared the protocol documentation with me, and after a fun weekend of hacking, Chess for Android now proudly supports DGT electronic chess boards as well.

DeepBrutePos for Android

Folkert van Heusen is developing a chess engine, called DeepBrutePos, and he also wrote a version for Android. The engine is written in Java, and he used the Android SDK to develop a version that acts as a chess server, so that it can be imported as network socket in Chess for Android (a rather unusual, but nifty use of that feature).
I conducted a quick test with one of the first versions. Below the results of a one-second-per move tournament from both sides of all Nunn opening lines on a Nexus One. I was hoping for better results for Folkert, but hopefully he will release a strong version soon. Good luck!
                       1        2          3         4         5        6                   
1 BikJump v2.1P        *     17.5- 2.5 20.0- 0.0 20.0- 0.0 20.0-0.0 20.0-0.0 97.5/100
2 fairymax48q       2.5-17.5     *     10.0-10.0 12.5-7.5  18.5-1.5 20.0-0.0 63.5/100
3 umax48w           0.0-20.0 10.0-10.0     *     12.0- 8.0 20.0-0.0 20.0-0.0 62.0/100
4 Chess for Android 0.0-20.0  7.5…

Filtering on ELO

Image
I got a useful suggestion at the talkchess forum for filtering the ELO rating of players. Rather than allowing individual ranges for white and black, I decided to provide a single range that applies to both the white and black player. In the example below, only games where both players have an ELO rating in the range "1200-1700" will be shown. Leaving the lower or upper field empty effectively makes that field unbounded (for "1200-" means all ELO rating 1200 and above, while "-1700" means all ELO ratings 1700 and below).



Android Engines Tournament: Group A

Image
Group A has finished a complete thirty seconds-per-move tournament in Chess for Android, played from both sides of all positions in the Nunn opening suite under the conditions described earlier.

Congratulations to Richard Vida for Critter's victory in this tournament!

All games can be downloaded from the tournament page.

This completes the Android tournament with longer time controls (although since many more engines are available now, perhaps another one is already necessary!).

                       1         2        3         4         5                    
1 Critter 1.2 32-bit       *     11.5-8.5  9.5-10.5  15.0-5.0  11.5-8.5  47.5/80
2 Stockfish 2.1.1 JA    8.5-11.5     *    13.0-7.0    9.5-10.5 11.0-9.0  42.0/80
3 Komodo32 2.03 AB     10.5-9.5   7.0-13.0    *      13.0-7.0  11.5-8.5  42.0/80
4 RobboLito 0.085g3l    5.0-15.0 10.5-9.5  7.0-13.0      *     12.0-8.0  34.5/80
5 IvanHoe-Beta v999947c 8.5-11.5  9.0-11.0 8.5-11.5   8.0-12.0     *     34.0/80



Rebel ELO Test Corrections and Results

Image
Running tournaments on diverse test suites gave me more confidence in the correctness of my FEN and PGN parser. This time Chess for Android found bugs in the "Rebel ELO Test". Positions ELO 30, 121, 170 do not set the castling rights for either black or white properly, even though castling is the first given move (that is, the move the engine is supposed to find when used as a tactical test suite; when used as an opening suite, this move is obviously played right away).

The results of (mis)using the corrected test suite as an opening suite in a fast match between the built-in Java engine and Stockfish 2.1 on a Nexus One is shown below.                   

1 Stockfish 2.1    +421/  -4/=27 96.13%  434.5/452
2 Chess for Android  +4/-421/=27  3.87%   17.5/452

Here is one of the sparse victories of Chess for Android playing white from a very advantageous position. Nevertheless, I am happy that it found the right continuation as 1. Qc8+ (given in the suite) Kg7 2. Qf8+ Kg6 3. Qf7+ K…

Max Euwe Suite Corrections

Image
I ran various tournaments using the "Max Euwe suite", from the hand of the famous grandmaster who inspired many Dutch aspirant chess players, including myself. During the first tournament, Chess for Android detected bugs in positions 146 and 148, where the castling rights are not set properly for white, even though white actually castles in the first given move (that is, the move the engine is supposed to find when used as a tactical test suite).

For example, in position 146, the embedded FEN string in the PGN file:

r1b1kb1r/p3q1pp/2pp1p2/4n3/3N4/8/PPP1BPPP/R1BQK2R w kq - 0 1

should really be:

r1b1kb1r/p3q1pp/2pp1p2/4n3/3N4/8/PPP1BPPP/R1BQK2R w KQkq - 0 1

Beat the Masters

Image
As a fun way to test the new opening suite feature, I conducted a fast match between the very strong Komodo 3.0 chess engine and the built-in Java engine of Chess for Android using the "beat the masters suite" (a version with 251 test positions). Komodo is clearly much too strong for my own humble engine and the suite was meant to test the quality of moves found by chess engines, not as an opening suite. Nevertheless, since some positions give one side a very strong advantage, it seemed like a fun way to test the new opening suite feature.

The outcome was as expected: Komodo won most games and only a few draws occurred. However, Chess for Android had one victory.

1 Komodo32 3 AB    +491/  -1/=10 98.80%  496.0/502 2 Chess for Android  +1/-491/=10  1.20%    6.0/502
In the position below, with black to move and only half a second thinking time per move, Komodo played 1... Rxe2, which yields a lost position (black should have played 1...hxg6).


Chess for Android did not find the short…

Opening Test Suites

Image
To eliminate the effect of opening books, it is a common practice to test the strength of chess engines by letting them play from both sides of a pre-selected set of opening positions. Earlier versions of Chess for Android already supported the option to play engine tournaments from both sides of 50 positions of the built-in book (yielding 100 games total between each engine pair). The upcoming 3.0 release will add the option to play both sides of any external book in PGN format, such as the famous "Nunn Positions" (published by GM John Nunn) or the "Silver Opening Suite" (published by Albert Silver).

To use this feature, long press the notation window, and select "UCI Engine Support", followed by "Engine Tournament". Then select the "all games from both sides of external book".


This will open a file navigation window, starting at the root of the SD card. Navigate into the directory and file of the desired opening suite. This will promp…

Chess for Android 2.9.4

Image
I just released version 2.9.4 for Chess for Android, available from the Android market or as direct download. This version introduces the much requested "infinite analysis" mode for an imported UCI engine, in which the engine reports its analysis of positions without actually making moves. To enable this mode, change the level to free play, as shown in the following screenshots.




If an UCI engine is imported, its analysis of the current position will appear below the board. The user can freely play through previous games or make new moves. When at the end of a game still in progress, pressing the ">" button will play the best move found by the UCI engine. Changing the level, or unloading the UCI engine will exit the "infinite analysis" mode.

Although the feature may seem simple, it was actually far from straightforward to implement, also because not all UCI engines behave the same for the "go infinite" command. Please let me know if you encoun…

Critter 1.2 for Android

Image
Richard Vida released Critter 1.2 for various platforms, including ARM-based Android devices. Below you can see some screenshots of this UCI engine running in Chess for Android.



To get a rough idea of the strength of this new engine, I conducted a few quick matches with other engines on a Nexus One using a random book opening play, one second-per-move, 32MB hash, and 8MB tablebases cache with the 3- and 4-piece Nalimov, Gaviota, Scorpio, Robbobases endgames on SD card. More games upcoming.

Critter 1.2
 - RobboLito 0.085e4l     3.5 - 6.5  +2/-5/=3   35.00%  - Komodo32 2.03 AB       5.0 - 5.0  +4/-4/=2   50.00%  - Stockfish 2.1          6.0 - 4.0  +4/-2/=4   60.00%  - GNU Chess 5.07.170.7b  7.0 - 3.0  +7/-3/=0   70.00%  - Gaviota v0.83          8.0 - 2.0  +7/-1/=2   80.00%  - Rotor 0.6a             9.5 - 0.5  +9/-0/=1   95.00%  - Toga II 1.4.1SE        9.5 - 0.5  +9/-0/=1   95.00%  - RedQueen 0.9.8        10.0 - 0.0 +10/-0/=0  100.00%
 - BikJump v2.1P         10.0 - 0.0 +10/-0/=0  100.00%  - Chess…

BikJump v2.0 released

Besides switching to a home-brewed bitboard representation, other parts of BikJump underwent refactoring as well. Some modifications turned out to modify strength negatively. I already wrote about null moves below. Furthermore, because the new bitboard move generator generates legal captures much faster than all legal moves, the quiescence search originally had been modified to look at captures only. After including checks again in the first few nodes, some bad tactical errors were avoided. Similarly, late move reduction had become too optimistic, and needed some adjustment towards the scheme used by the older BikJump.

The "perft" nodes-per-second performance (which everybody measures differently; I simply traverse the complete tree with the same move generator that is used in search, including some bookkeeping) is about 13000KNs on a 2.66GHz Core 2 Duo. The nodes-per-second of the actual search in the first Nunn position is now about 1070KNs (64-bit) and 790KNs (32-bit) on a…

A nice result

While I am struggling to translate all "improvements" of BikJump v2.0 into actual stronger play, BikJump v1.8 became third in group A of the 5th Division WBEC Ridderkerk edition 16 and qualified for the final.

Chess programming is interesting

It took a while, but I now like everything about the new rewritten BikJump better. The code has become much cleaner, bitboards suit me better than the mailbox representation, move generation is much faster (most apparent for 64-bit, but also for 32-bit), the search heuristics are more intuitive, the evaluation function has more chess knowledge, and the new version scores much better on tactical problem test suites.

So, can I finally release v2.0? Unfortunately not. Despite all these apparent improvements, BikJump v2.0 still scores less than 50% against BikJump v1.8 in blitz games. I am puzzled. More analysis is required....