Designer wanted: Western pieces for Chinese chess 2014-09-21 No Comments


Chinese chess is a lot easer to get into for non-Chinese people if a horse looks like / rather than 馬/傌, for the first few games. Publicly available piece set graphics seem to all have one or more of the following shortcomings:

  • Raster but vector images
  • Unclear or troublesome licensing
  • Poor aesthetics ([1], [2], [3], [4], [5], [6])
  • Lack of elephant, cannon/catapult, advisor pieces


Simplified, what I am looking for is

The resulting graphics will be published with CC0 Public Domain Dedication licensing for use to everyone. Particular use cases are use with xiangqi-setup, XBoard/WinBoard and Wikipedia.

In more detail

  • Seven pieces per party: Chariot/rook, horse, elephant, advisor, king, cannon/catapult, pawn
  • Use black “ink” only: Black pieces should be all black with parts cut out, “white”/”red” pieces  should be black outlines with body cut out (example here)
  • No two pieces should be hard to distinguish, in particular not:
    • Pawns, advisors and king
    • Elephants and horses
    • Cannons and chariots
  • Advisors should not look similar to queens in western chess
  • Flat 2D is fine. If some pieces imitate 3D, all of them should (so no flat and pseudo 3D in the same set)
  • Needs to work at small sizes. So either two sets for small and regular display or one set that works at any size.
  • Pieces should not have a circle for a background (unlike this)
  • Not too arty, not too fancy, specific rather than abstract. Clean and simple but appealing, please.
  • Chinese culture elements welcome, if you know how to use them well.

Are you interested in working on this project? Please get in touch!

LaTeX xq: Bugs in 0.3 fixed with 0.4 / My first contribution to CTAN 2014-09-20 No Comments


When writing about Xiangqi (Chinese chess) in LaTeX, it’s tempting to use package xq. When Wolfgang Reher and I used it for a while, we ran into bugs with it: some bad enough, I can only ask you to upgrade to 0.4 asap and not render anything with 0.3 any more. For details, there is a document bugs-0-3.pdf, demonstrating what you could run into with 0.3 without even knowing. It took us quite a while to see, too. And there is a change log, of course.

On a final note, when starting fresh I would currently recommend embedding PDFs made from xiangqi-setup SVG output (hint: Inkscape in command line mode!) over using LaTeX xq, personally. Reasons include:

  • Free scalability (rather than two sizes)
  • Completely drawn lines inside the palace
  • A selection of themes, both board and pieces

Also, maybe re-invent xq’s \move command (which is doing the listings) if you consider moving to text floating around images (wrap-figures), later.

By the way, Package xq is looking a new maintainer. Interested?

My first cover on a printed book 2014-09-13 No Comments

A few days ago I had the chance to first get my hands on a printed version of that book I designed the cover for: Einführung in die Mittelspieltaktik des Xiangqi by Rainer Schmidt. The design was done using Inkscape and xiangqi-setup. I helped out with a few things on the inside too.

A few links on the actual book:

PS: Please note the cover images are “all rights reserved”.

Fwd: Rudimental & Ella Eyre – Right Here (Capital FM Session) No Comments

Something I ran into…
Rudimental & Ella Eyre – Right Here (Capital FM Session)

Generating Xiangqi setup images, publishing/print level quality 2014-08-04 No Comments

(Last edit 2014-08-31)

I wrote a tool that takes the board setup from a WXF file (example below) and produces an SVG image visualizing that setup.
Different themes for board and pieces are supported (including your own), the gap between pieces can be adjusted, output width can be adjusted, too.
It’s called xiangqi-setup.

Internally, the tool takes the an SVG file of the board, places piece SVGs at the right places and saves the result.
The tool uses svgutils by Bartosz Telenczu. I’m very happy he made that available as free software. My tool is free software (licensed under GNU AGPL 3.0 or later) too, of course.

If you want to imitate the style of Chinese end-game books, you could go with these themes:

(Image licensed under CC0 1.0 Universal: Public Domain Dedication)
If you want to imitate LaTeX xq 0.3 style (with added flexibility), you could go with this:

(Image licensed under CC0 1.0 Universal: Public Domain Dedication)
If you would rather go for something more colourful, for screen rather than print, or you want to explicitly imitate the look of, you could go with this:

(Image licensed under CC0 1.0 Universal: Public Domain Dedication,
piece artwork kindly shared and released by PlayOK)
There is a version of the pieces without shadows (for PDF generation), too.

Latter image was created running

# ./xiangqi-setup \
    --board themes/board/playok_2014_remake/ \
    --pieces themes/pieces/playok_2014_chinese \
    --scale-pieces 1.025 \
    --width-px 400 \
    demo.wxf setup_imitate_playok.svg

This what you pass in: a WXF file (e.g. produced by XieXie by saving with .wxf extension):

FORMAT          WXF
RED             ;;;
BLACK           ;;;
DATE            2014-07-16
FEN             4kaer1/4a2c1/2h1e1h2/3Rp1C1p/2C6/5rP2/1pP1P3P/8E/9/1cEAKA1R1 b


As of now, the complete usage of xiangqi-setup is:

# ./xiangqi-setup --help
usage: xiangqi-setup [-h] [--board DIRECTORY] [--pieces DIRECTORY]
                     [--width-px PIXEL] [--width-cm CENTIMETER] [--dpi FLOAT]
                     [--scale-pieces FACTOR] [--debug]
                     INPUT_FILE OUTPUT_FILE

positional arguments:

optional arguments:
  -h, --help            show this help message and exit
  --board DIRECTORY
  --pieces DIRECTORY
  --width-px PIXEL
  --width-cm CENTIMETER
  --dpi FLOAT
  --scale-pieces FACTOR

For themes, these are your options (at the moment):

# find themes -maxdepth 2 -type d | sort

If none of the existing themes fit your needs, you may create board and/or pieces of your own.
For boards, drawing a custom grid, palace, start markers and border can be done using the xiangqi-board tool. A demonstration of its current options:

# ./xiangqi-board --help
usage: xiangqi-board [-h] [--line-thickness-px FLOAT] [--field-width-px FLOAT]
                     [--field-height-px FLOAT] [--border-thickness-px FLOAT]
                     [--border-gap-width-px FLOAT]
                     [--border-gap-height-px FLOAT] [--cross-width-px FLOAT]
                     [--cross-thickness-px FLOAT] [--cross-gap-px FLOAT]
                     SVG_FILE INI_FILE

positional arguments:

optional arguments:
  -h, --help            show this help message and exit
  --line-thickness-px FLOAT
                        Line thickness of square fields in pixel (default: 1)
  --field-width-px FLOAT
                        Width of fields in pixel (default: 53)
  --field-height-px FLOAT
                        Height of fields in pixel (default: 53)
  --border-thickness-px FLOAT
                        Line thickness of border in pixel (default: 2)
  --border-gap-width-px FLOAT
                        Widtn of gap to border in pixel (default: 40)
  --border-gap-height-px FLOAT
                        Height of gap to border in pixel (default: 40)
  --cross-width-px FLOAT
                        Width of starting position cross segments in pixel
                        (default: 10)
  --cross-thickness-px FLOAT
                        Line thickness of starting position cross in pixel
                        (default: 1)
  --cross-gap-px FLOAT  Gap to starting position cross in pixel (default: 4)

For text on the river, the characters are:

  • Chu river: 楚河
  • Han border: 漢界 traditional, 汉界 simplified

On the Open Source font end of things these are your main options to my understanding:

On a side note, in Gentoo Linux look for these packages:

  • Adobe Source Han Sans: media-fonts/source-han-sans (gentoo-zh overlay)
  • AR PL UKai/UMing CN/TW: media-fonts/arphicfonts
  • Google Noto Sans CJK: media-fonts/notofonts (betagarden overlay)
  • Wangfonts: media-fonts/wangfonts (gentoo-zh overlay)
  • WenQuanYi Micro/Zen Hei: media-fonts/wqy-microhei, media-fonts/wqy-zenhei

If you use xiangqi-setup tool to generate images, feel free to drop me a mail, I would be curious to see your results and check out your custom themes. I would not mind a free of copy of your book, either :)


Things not to do when publishing a book on Xiangqi (or any other topic) 2014-08-03 Comments Off

One minute version

If you’re buying an English book on Xiangqi do not buy “A Beginners guide to Xiangqi” by Tyler Rea: It’s a ripp-off and does more harm than good.
For something in English, you could go with “Chinese Chess: An Introduction to China’s Ancient Game of Strategy” by H. T. Lau for print or browse, instead.


  • First, sorry for the poor picture quality!
  • If I highlighted say two errors in a picture below, it does not mean it’s only two.
  • This review is not meant to be complete: it’s way too much already.

How did I get here?

I ran into this video on YouTube:

While I’ve been playing Xiangqi for quite a while already, I was thinking “that book looks like fun, I’ll buy it just to have a closer look, maybe there’s something in there that I haven’t seen yet, too“. So I did have some expectations.

I started skip-reading through the book and soon stumbled over error after error: to the point of laugh-or-cry. It starts with the cover page, already. Read on for details.

Quick review summary

  • Whole chapters match Internet content 1:1 (mostly, also
  • About 100 pages are wasted to two uncommented example games, one move per page.
  • Of those, the first example game is declared a win when the king is not even in check.
  • Poor teaching (mis-leading, logic errors, no examples where needed)
  • No chapter explaining AXF/WXF (or any) move notation (despite use in the book)
  • Many errors details, spelling, case, punctuation (even on cover page)

The book lacks declaration of an edition or a print date. It does say “Printed in Germany by Amazon Distribution GmbH, Leipzig” at the end.
According to the book’s Amazon page it was published at/by CreateSpace: Self Publishing and Free Distribution for Books, CD, DVD, “an Amazon company” in 2013.

This beginners guide is actually a beginner’s guide. Maybe that’s a typo.

The cover says it loud and clear

Interesting things to spot on the cover:

  • “Writen” should have been “Written” with double “t”
  • On the bottom, Red’s king and elephant use the characters of Black
  • Red’s pawns show characters of Black’s pawns and vice versa

Too bad I noticed all of that after buying.

Whole chapters match Internet content 1:1

So far I have identified these matches with Internet content (some 1:1, some adjusted):

The author of confirmed to me via e-mail that use of his content in that book has not been authorized/licened by him.

The two places where I noticed copying first:

At page 170 it reads “term use[d] on this site” rather than “in this book“:

At page 49 the “Basic, commonly used tactics in Xiangqi” is not a complete sentence and does not have a full stop either. That is because in the original that is the title of a section, not a sentence.

On the example games

While showing a complete game move by move could be helpful in teaching, a few things went wrong in general:

  • Moves should be commented, e.g. “Red is attacking piece X to make up for blacks attack against ..” rather than “Black has responded by advancing the horse”.
  • WXF/AXF and algebraic move notation could have been shown: There is plenty of space for that.
  • Since there are no arrows indicating the current move on the board, “finding” the move is much more work than necessary, especially when turning pages.
  • No more than a single move per page is plain waste of paper.
  • Roughly 100 pages for two examples games take more than half the page count.

On the first game in particular: The game ends at move #79 of Red which is commented as:

WINNING Move #79, Red secures Checkmate. Black’s General is it check from Red’s Chariot and Red’s General as part of a Face to face laughing check.

That’s rather surprising since Black is not even in check after Red has moved. Is this a joke?

On the second game: page 167 shows the second last move of the game. Black responds with R9+2 / Ri0-i8. How does that do anything against the threat of C5=6 / Ce5-d5 by Red? What about C2=5 / Cb8-e8 for a proper reply? If we assume a really poor opponent, maybe that deserves mentioning.

Also, let me use the occasion to point out the characters used for Red’s king and advisors. A friend of mine who has been studying English, Chinese and German literature on Xiangqi for years said he has never seen those characters used anywhere in the context of Xiangqi.

The quality of teaching

This page is meant to teach movement of the king:

What I see is:

  • Pictures indicating movement of more than one step at a time
  • Lack of a system: it’s neither where-to-go-from-here nor where-could-he-have-come-from

Up next is the first oddity I noticed very first: How would the two pawns go sideways before crossing the river?

This page is meant to explain movement of the horse. With that little blocking pieces there are quite a few move options missing.

Here the idea seemed to be: show all possible steps a pawn can do. However, there are lots of arrows missing:

This one is really bad: If I hop my cannon right in front of the king with no protection, he eats my cannon and that’s it:

To me, this dry list of checkmates clearly lacks examples:

No chapter on move notation

Despite use of AXF notation in the book, there is no chapter explaining how to read or write that (or any) move notation. Why not?

Many errors at details, spelling, case, punctuation

In a printed book, finding spelling mistakes is expected to be hard. Not so with this book: A few examples.
On page 4 we can see how punctuation is pulled into quotes — always but once:

The word “Xiangqi” can be found in the book as “Xiàngqí“, “Xiànqí” (typo, lacks “g“) and “Xiangqi” (without accents):

Also, uppercase is used at interesting places, e.g.

  • Page 44: “leap frog Perpetually”
  • Page 45: “The Anatomy and structure”
  • Page 39: “to Augment your defense”

to name a few.

That’s all for the moment.

(Update 2014-08-31: The book is “out-of-order” on and .de; as of today, it is sold by a reseller for 32.05 EUR at and for 189.20(!) USD at

(German) Zu “Ran an die Buletten” von Elisabeth Raether, ZEITmagazin #33, 17. Juli 2014 2014-07-22 Comments Off

Die Titel-Story des ZEITmagazins Nummer 33 vom 17. Juli 2014 heißt “Ran an die Buletten” und ist eine verzweifelte Kampagne von Elisabeth Raether, die Reputation der Fleisch-Esser wiederherzustellen: Weiter Fleisch essen aber weniger schlecht fühlen dabei. Zum Untertitel “Warum fleischlose Ernährung größer Käse ist” wird keine schlüssige Argumentation geliefert, auch sonst werden keine ernstnehmbaren Schlüsse angeboten.

Ich hatte erst überlegt, selbst mit dem digitalen Rotstift ranzugehen, eine ernsthafte Analyse des Textes auszuarbeiten, aber das erscheint mir inzwischen als Zeitverschwendung.

Nur zwei Zitate möchte ich bringen:

[..] Fleischessen ist der Genuss der Ignoranten geworden, wie SUV fahren und Kette rauche.

Ich schreibe im ZEITmagazin eine wöchentliche Rezeptkolumne. Wenn ich etwas zu Hähnchen oder Hackbällchen schreibe, bekomme ich vorwurfsvolle E-Mails und Onlinekommentare.

Hier findet sich also die Motivation zum Schreiben des Artikels.

Der Verzicht [auf Entrecôte] wäre kein Geringer. [..] Haben wir nicht so etwas wie eine moralische Verpflichtung, uns am Leben zu erfreuen?

Ohne Worte.

Ein paar der Kommentare zum Artikel online sind recht gut oder amüsant. Meine Verwunderung auf den Punkt bringt dieser Kommentar von Nutzer “Bird Henning”:

Wie kann es sein, dass die ZEIT soetwas veröffentlicht? Gibt es keine Verantwortlichen, die so einen Bockmist verhindern können? Oder darf da jeder schreiben was er will und es wird unter die Menschen gebracht?
Ich bin jedenfalls sprachlos, so etwas hier in einem doch so “seriösen Magazin” zu lesen.

Die Kommentare und die sieben “widerlegten” Annahmen finden sich auf der Seite des Magazins. Den gesamten Artikel müsste man kaufen, aber davon möchte ich explizit abraten: Das wäre Geldverschwendung.

Fwd: Dan Jaspersen: Blur[ring] the line [of human potential] 2014-07-14 No Comments

I just watched a TED talk that I would like to share with you.

First, let me quote a line from that talk that works without much context:

Next to the technologie, entertainment and social media industries
we now spend more time with other people’s ideas than we do with our own.

For the remainder, see for yourself: Blur the line: Dan Jaspersen at TEDxCSU

Audible “Command done” notifiction on the shell 2014-07-13 2 Comments

Background story / context

At work I’m dealing with a test suite running >30 minutes, even on moderately fast hardware. When testing some changes, I launch the test suite and start working on something else to not be waiting for the test suite. Now the sooner I know that the test suite finished execution, the sooner I can fix errors and give it another spin. So checking the test suite for being done manually is not efficient.

The problem

What I wanted was a notification, something audible, looped, like an alarm clock. Either

$ ALARM_WHEN_DONE cmd [p1 p2 ..]


$ cmd [p1 p2 ..] ; ALARM

usage would have worked for me.

My approach

I ended up grabbing the free Analog Alarm Clock sound — the low-quality MP3 version download works without registration — and this shell alias:

alias ALARM='mplayer --loop=0 ~/Desktop/alarm.mp3 &>/dev/null'

With this alias, now I can do stuff like

./testrunner ; ALARM

on the shell and never miss the end of test suite execution again :)

Do you have a different/better approach to the same problem? Let me know!

PS: Yes, I have heard of continuous integration and we do that, too :)

EGF Xiangqi file format tool and documentation 2014-07-06 No Comments

Hello :)

I don’t get to playing with code much lately. Yesterday and today I put some effort into trying to understand and document the EGF file format used by Xie Xie to store Xiangqi games including per-move comments and a bit of other metadata.

Status quo includes a simple command line tool:

# ./egf/ test.egf 
Event:  Blog post
Site:  At home
Date:  6-7-2014
Round:  1
Red name:  sping
Black name:  Xie Xie Freeware 2.5.0
Description:  Command line tool demo input
Author:  sping

File i:  R _ _ P _ _ p _ _ r
File h:  H _ C _ _ _ _ c _ h
File g:  E _ _ P _ _ p _ _ e
File f:  A _ _ _ _ _ _ _ _ a
File e:  K _ _ P _ _ p _ _ k
File d:  A _ _ _ _ _ _ _ _ a
File c:  E _ _ P _ _ p _ _ e
File b:  H _ C _ _ _ _ c _ h
File a:  R _ _ P _ _ p _ _ r
(Ranks 9 to 0 from left to right)

To start:  red

6 single moves in total
[ 1]  c h3  - e3 
[ 1]                   H h10 - g8 
[ 2]  h h1  - g3 
[ 2]                   R i10 - h10
[ 3]  r i1  - h1 
[ 3]                   C h8  - h4 

Result:  to be determined

Bytes remaining to be read:
0 0

I welcome help to fill in the remaining blanks, e.g. with decoding time markers and king-in-check markers of moves.

If you are on Gentoo and would like to run Xie Xie the easy way, grab games-board/xiexie-freeware-bin from the betagarden overlay.

EGF files for inspection can be downloaded from