Wednesday, November 18, 2009

En-passant and castling

About once a week, I get an email from a user who claims that Chess for Android makes an illegal move with the pawn or king. Invariably the user is not familiar with en-passant or castling. Therefore, I decided to post a brief summary of these rules.

In the en-passant capture (click for more details), a pawn that just moved two squares can be taken by an opposing pawn as if it only moved one. To perform this move in Chess for Android simply move the pawn as if making the capture, as illustrated below.

The castling move (again, click for more details) involves the king and one of the rooks. The king moves two squares to the left or right while the rook jumps over the king to the adjacent square. The move is only allowed if neither piece has moved before, the path between the pieces is clear, and the king is not in check or crosses a square where it would be in check. To perform castling in Chess for Android, simply move the king two squares to the left or right, as illustrated below.

Monday, November 9, 2009

New Game and Undo

I just posted version 2.1.1 of Chess, Checkers, and Reversi for Android at the Android Market that allows starting a new game or undoing the last played human move while the computer is thinking. In the older versions, this could only happen during the human player's turn. The latest releases remove that unnecessary restriction.

As before, keep in mind that each undo takes back only one half-move (ply). This means that each undo effectively switches the side-to-move. Either use "Switch Side" or make your move on the board to start the engine again.

Friday, October 23, 2009

Status Bar Back!

Although many users seem to like the new full screen, some users really want to see the status bar at all times. Therefore, I just released versions of all my Android games that give the choice between hiding or showing the status bar (in both cases, the screen is still used more efficiently than in the older versions).

This is how a screen without status bar looks.

To enable the toolbar, press the menu button and select "Options".

Then de-select the "Full Screen" option to get the status bar back.

Thursday, October 22, 2009

Changing the Board or Pieces

The new release of Chess for Android gives a choice in board style and chess piece sets (others may be added later). To change, press the menu button, which will give you the following screen.

Then, select "Options", which will show you the following choices.

To switch from a wooden board to a more classic board, de-select the "Wooden Board" button. The piece set can be changed similarly. After this, the chess board has a completely different appearance, as illustrated below.

Checkers for Android supports the same choice in board styles.

Tuesday, October 20, 2009

Android Updates

I just posted v2.0 of Chess, Checkers, and Reversi for Android at the Android Market with the following improvements:

=> Small, normal, and large screen size support.
=> Full screen board layout.
=> On screen buttons moved to menu.
=> Unified trackball cursor.
=> More levels of strength.

In addition, chess has been improved with:

=> Choice of two chess piece sets.
=> Rotating board.

Monday, October 19, 2009

Full Screen Chess

Her is a preview of the upcoming Chess for Android on a small, normal, and large screen. The full screen is used for the board layout. It also uses a new chess set, designed by my sister Elisabeth (awesome job, thanks!). Other upcoming improvements include board rotation (so that the player can see the pieces from the perspective of either white or black), a choice in chess sets, and an enhanced menu (rather than mixed on-screen and menu buttons).

Friday, October 16, 2009

Full Screen Android

While preparing my applications for the wider variety of screen sizes, I also eliminated the title bar and "wooden" border in favor of a larger board size. Especially in landscape mode and for the upcoming smaller screens, this will hopefully enhance the playing experience.

As a preview, a screenshot of Reversi for Android before and after shown below (ignore the stuff on the right for now; that is subject to change too). Checkers and Chess for Android will change similarly.

Monday, October 12, 2009

Vectorization Code Samples

It has been a long while since I published The Software Vectorization Handbook but occasionally I get an email on the topic. Recently someone asked me whether I could make the examples in the book available electronically. Luckily, I found all examples in my older archives, and I posted code samples on my website.

Multiple Screen Sizes

Up to now, my Android applications assume a fixed screen size (HVGA 320x480) and, although portrait and landscape views are supported, the code that implements board layout is not general enough to deal with all sorts of screen sizes.

Android is designed to run on a variety of devices with different screen sizes and resolutions, however, and starting with version 1.6, multiple screen sizes should be handled.

Just for fun, I tested how my applications would run on various screen sizes. The screen shot for reversi is shown below. As expected, I have some work to do to make my applications more compliant with the latest extensions. This also may give me an excuse to implement some of the other requested features (such as rotating the board when playing black in chess).

Friday, September 11, 2009

Back to BikJump

November last year, I posted a blog entry on my progress with "Deep" BikJump, i.e. adding multi-threading to my engine to speedup the search. Due to many distractions, I have not worked on that feature since that posting....

The chess engine bug is starting to itch again, however, so I decided to pick this up. Hopefully I can release a SMP version of BikJump soon!

Thursday, September 3, 2009

WBEC-Ridderkerk Ratings

Leo Dijksman kindly posted a chess engine rating list on the WBEC-Ridderkerk forum, based on edition 11 to 16 of the WBEC-Ridderkerk computer chess competition. Below I show some stats for various versions of BikJump.

Rank Version Elo + - games score oppo. draws
517 BikJump 2.01-x64 2111 105 105 30 50% 2109 27%
609 BikJump 1.8-x64 1995 132 125 30 70% 1798 20%
662 BikJump 1.1 1911 141 160 26 23% 2199 8%
693 BikJump 1.5 1851 131 131 25 50% 1823 12%

Many thanks to Leo for providing the ongoing WBEC tournaments!

Monday, August 17, 2009


With an eye on California's water shortage, we decided to do some water-efficient landscaping. With enormous help of my sister, we converted a corner of our front lawn into a mini cacti corner.

In another corner, far away from playing children, we decided to put some larger, more thorny cacti. Hopefully this way we can keep the garden green with less water!

A Fallen Tree

This weekend a large branch of my neighbor's tree broke and fell into our garden, right on top of our swing and patio furniture. Luckily nobody was hurt, since we all just came back from church when it happened. The swing broke most of the fall and even the solar panels survived!

Needless to say I spend the rest of the day cutting wood, very kindly assisted by neighbors from all sides!

Thursday, August 13, 2009

Thanks Android Game Users!

The last few weeks, I received many very kind emails as well as positive comments at the Android Market about my games. This has been a very nice contrast with the sometimes rough comments or emails I also get (constructive feedback is always welcome, but please study the rules of the game before you complain :-)). So I just wanted to say thank you to all that took the time to write a nice email or comment!

Friday, August 7, 2009

Trackball Input

By popular request, I have changed the trackball input of Chess for Android slightly. When the trackball cursor hovers over the chessboard, it is displayed as a rectangle that moves one square at the time.

When the trackball cursor leaves the chessboard, it changes into the "old-style" cursor that moves several pixels at the time. Please let me know if you like this new input mechanism better.

Thursday, July 30, 2009

Are You Really Sure?

Several users requested a confirmation dialog when starting a new game in Chess for Android to avoid resetting a game in progress by accidentally hitting the new game button. Therefore, I just posted v1.5.5 at the Android Market that adds this feature, illustrated below.

Although not directly requested, I have added this feature to both Checkers and Reversi for Android as well.

Thursday, July 23, 2009

Math Worksheet Generator

My daughter just started to learn addition and subtraction in school. Like a true nerd, I wrote a Java applet to generate math worksheets, so that I no longer have to write out exercises by hand.

To try it out, go to math worksheet generator.

Click on the top-right +/- buttons to increase and decrease the level of difficulty, click on the ADD/SUBTRACT button to toggle between additions and subtractions, or click anywhere to generate new exercises. Feel free to print the math worksheets for your own use (unfortunately, this may not work for some browsers).

Wednesday, July 22, 2009

Reversi for Android Update

I made minor improvements to the reversi move generator and evaluation function in version 1.5.5, hopefully resulting in stronger play. Unfortunately, in my excitement I forgot to add a new internal state to the save/restore functionality, which could introduce wrong play if a game was exited and later resumed. This has been fixed in version 1.6 of Reversi for Android. Many thanks to Patrick Barnes for reporting the bug (with a screen shot as illustration!).

Tuesday, May 12, 2009

Android Updates: Save on Exit

I just posted version 1.5 of Chess, Checkers, and Reversi for Android at the Android Market, all with the much requested "save on exit" feature. If a user exits a game in progress, the game is automatically saved and later restored when the application is restarted. Even if the interrupt happened while the engine was thinking about its move, the game will restart in that state (albeit taking the full allocated time again). Apologies to all users who have been requesting this feature for a while, I just needed to find some time for it.

Friday, May 1, 2009

Dutch Royal Attack

With tears in my eyes I read the news and watched the pictures of the senseless attack on the Dutch royal family by a man who crashed his car through the crowd during the annual Queen's Day celebration. I pray for the victims and those who mourn.

Friday, April 10, 2009

Chess for Android Update

Version 1.4 of Chess for Android is now available at the Android Market with the following new features:
  • Two improvements in the engine: removed unnecessary restriction on search depth and fixed bug that could cause an out-of-bounds exception.
  • The engine now detects draw by a simplified form of three fold repetition. The detection is not complete, since only limited game history is kept; but at least this new feature avoids some very annoying repetitions. Draw by the fifty move was already implemented.
  • A new level "Auto-play" has been added (press the Menu button). If this level is selected, then the next time the engine takes control (make either a move or touch "Reverse sides"), the game is played automatically.

Monday, March 30, 2009

ChessWar and WBEC Ridderkerk

Due to all Android distractions, it has been a while since I posted on BikJump. It recently ended at a somewhat disappointing 54th place in OpenWar 5th Edition. Version 2.01 is now playing in the final of the 5th Division WBEC Ridderkerk edition 16.

Monday, March 9, 2009

A New Checkers Engine: BikMove

I ported the Java source code of the engine in Checkers for Android into C++ and implemented the parts required to form a plug-in engine for Martin Fierz' CheckerBoard application. The result is BikMove (with an obvious wink to my UCI chess engine BikJump). I also added the ability to query checkers endgame databases based on Martin Fierz' probing code (used with his kind permission). The main features of BikMove are listed below:
  • Checkerboard compliant checkers engine.
  • Iterative deepening, alpha-beta pruning.
  • Queries endgame databases during search.

The engine needs some more work to become competitive with others checkers engines, but it already plays what looks to me like decent checkers. Give it a try if you are interested!

Friday, February 20, 2009

Perft for Reversi

As can be seen in previous postings, the perft method is useful to verify the correctness of a move generator. The method traverses the game tree up to various, increasing depths to count all leaf nodes. The results are compared with pre-computed values to isolate bugs. Although the method originated in the chess programming community, the same debugging principle can be used for any board game with deterministic rules. So far, I have used perft to verify the move generation of Chess for Android and, thanks to Martin Fierz, also for Checkers for Android. I was unable to find pre-computed perft numbers for reversi, however.

Therefore, here is what is probably the debut of perft for reversi from the initial position, hopefully useful data for aspirant reversi programmers (at depths 9 and up, "passing" moves start to occur; at depths 11 and up, higher leaf nodes in which neither player can move start to occur).

1 4
2 12
3 56
4 244
5 1396
6 8200
7 55092
8 390216
9 3005288
10 24571284
11 212258800
12 1939886636

Perft is also useful to analyze and improve the performance of a move generator. Today I made some optimizations in the reversi move generator that improve performance almost two-fold, posted as version 1.3.4 of Reversi for Android at the market.

Wednesday, February 18, 2009

Checkers Move Generation

I was able to make a small improvement in the checkers move generator (written in Java for the Android SDK). The following table shows run times of several perft depths before and after optimization when run on the emulator (which should mimic actual run times on the phone quite well).

7 179740 2.9s 1.9s
8 845931 14.2s 9.7s
9 3963680 66.3s 45.6s
10 18391564 294.6s 208.7s

P.S. Runtimes for a C++ checkers move generator on a 2.2 GHz Core 2 Duo are given at my checkers page.

Friday, February 13, 2009

Perft for Checkers

Martin Fierz kindly extended his engine Cake with a perft feature. Luckily the numbers reported by Cake match the numbers reported by Checkers for Android exactly. Below the numbers from the start position are shown, hopefully useful data for aspirant checkers programmers.

1 7
2 49
3 302
4 1469
5 7361
6 36768
7 179740
8 845931
9 3963680
10 18391564
11 85242128
12 388623673

Wednesday, February 11, 2009


If you are looking for a checkers program for Windows, I can highly recommend Martin Fierz' CheckerBoard, consisting of a checkers GUI that features game databases, opening books, endgame databases, and various checkers engines (including the capability to plug in your own as DLL). I have used his engine Cake as "sparring partner" to test the correctness and strength of Checkers for Android. Needless to say, Cake won, but the games at least assured me that my Android version plays correct checkers. Martin also kindly responded to my request for adding a perft feature to Cake, which will enable verifying the correctness of my move generator against his.

Wednesday, February 4, 2009

Yet Another Update

I am on the roll with updates! Version 1.3.2 of Chess for Android uses a larger font for the move list and highlights the last moved played by the engine (controlled by the already existing "show valid moves" button).

I am thinking about a version 2.0 with a completely new board layout to use the limited screen space more effectively. As usual, keep an eye on this blog if you are interested.

Thursday, January 29, 2009

More Android Updates

Two minor updates at the Android Market.

Version 1.3.1 of Checkers for Android has a slightly improved search and evaluation in the checkers engine. Some users complain the engine plays too strong, others say it is too weak. Needless to say I enjoy the challenge of making a strong engine more. I also added an "undo" feature for this game.

Version 1.3 of Chess for Android now also has the option to disable highlighting all valid moves once a piece has been selected for more experienced chess players. I also modified the on screen button layout.

Tuesday, January 27, 2009

Reversi for Android Update

Version 1.3 of Reversi for Android at the Android Market adds an "undo" feature of the last move (to correct a mistake) and an option to disable the "ghost stones" for all valid moves (for users that prefer to see the board as in real-life).

Thursday, January 15, 2009

Fixed Castling Bug

I posted version 1.2.2 of Chess for Android at the Android Market that fixes a bug that would sometimes allow castling when no longer legal. I validated the move generator of the chess engine by doing a perft (an internal feature) on several board positions to minimize the probability of other bugs related to move generation.

Friday, January 9, 2009

Trackball Support

I just posted version 1.2.1 of Chess, Checkers, and Reversi for Android at the Android Market with trackball support. A small circle denotes the trackball cursor, as illustrated in the screen shot below. Hopefully this will make the input easier. Many thanks to Chris Bueno for quickly testing the applications shortly after posting!

Monday, January 5, 2009

G1 Android Phone

I received my own G1 (well, strictly speaking, the Android Dev Phone 1™)! This means now I can (1) read all user comments posted at the Android Market, and (2) experience my applications on the real device, rather than on the emulator. After just a few minutes I must agree with users stating that touch screen input is rather hard given the board size (something I could never experience on the emulator, where touch is emulated with mouse input). So, trackball support may be a good idea after all.

Sunday, January 4, 2009

More on User Feedback at the Android Market

I can now read the last few comments that are posted at the Android Market for each application. For chess and reversi, feedback is mostly constructive. I was very shocked, however, to read the comments posted for checkers.

People freely post four-letter words and do not shy away from personal insults. Why? Because the application uses the official straight checkers rule where jumps are mandatory? Perhaps, but adding an option to make captures optional did not seem to help. Because graphics are not advanced? True, but I wrote the game for fun and give it away for free! Because the application plays too strong (or too weak)? I assumed people like a challenge (and, conversely, I still have ideas for improving the strength of the checkers engine).

Ironically, I implemented checkers by popular demand after I released chess and reversi in the hope people would enjoy the application. But now I am starting to regret this somewhat after reading too many ill-mannered comments and emails....