Stuart Spence Blog

Computer scientist and educator. Creator of ChessCraft. Senior computer scientist at Environment Canada.

Fri 20 September 2019

Release 1.3: Premoves, Visual Themes, Eleven Languages

Posted by Stuart Spence in ChessCraft   

The new version of ChessCraft is here! What's new, you ask?

  • Premoves
  • Choose a visual theme: minimalist, or wood.
  • Say au revoir to English! Play ChessCraft in one of eleven languages. That was something.
  • Computer complexity and human complexity tips.
  • Kangaroos.
  • Bug fixes and UI improvements. Thanks for all the feedback!

If you don't see the update yet, patience! Google Play can be mysterious.

Premoves

I've been dying to implement this for awhile! When the computer is thinking, if you're confident about your next move you can submit it in advance. Convenient! Enable premoves in "options". Premoves are disabled by default so that I don't confuse newbies and kids.

Visual Themes

Someone commented once that having my map as a background is ugly and distracting. I respectfully disagree, but point taken. I've added the option to choose either:

  • my beautifully hand drawn, artistic background with classy wooden tiles... or:
  • a minimalist, lichess.org style and colours

If you have some preference for another visual theme, now is a great time to let me know!

chesscraft screenshot

chesscraft screenshot

Translation

Perfect is the enemy of the good? This was a lot of work, folks. ChessCraft now adjusts to your system language (an app restart is required):

  • English
  • French
  • Spanish
  • Portuguese
  • Chinese
  • German
  • Italian
  • Russian
  • Japanese
  • Korean
  • Dutch

There are over 400 pieces of text in ChessCraft, so translating 11 languages involved filling in a 400 by 13 spreadsheet. I also have zero budget, and I'm no omniglot. Fortunately, if you type something like this into a Google Spreadsheet:

=GoogleTranslate("chess","en","fr")

Google Translate (GT) will automatically translate "chess". If I stopped there, my translations would be laughably bad. I took several more steps, involving lots of custom code and automated verifications:

  • There are two versions of English. The English you see in English ChessCraft, and "easy-English" that I use to translate from.
  • I'm fluent in French, so I proofread each French translation. This helped catch words like "range" which were sometimes mistranslated as "farm range". I manually replaced words like "range" in the easy-English with words like "distance" until the French was automatically translated reasonably well. Presumably this greatly improved the other translations too.
  • I made minimal manual corrections to the French, instead I tried to make the easy-English better for (presumably) all translations. Simple sentences and verbs.
  • I substituted critical words like "bishop" and "check" into "bbbbb" and "ccccc" in easy-English. GT skips these codes. I then carefully translated those words for all languages, using wikipedia or chess vocabulary glossaries. Then I substituted the words automatically back into the GT results. The grammar will sometimes suffer (like plurals and gender), but it will be comprehensible.
  • Given a list of two pieces like "pawn" and "dragon" ChessCraft needs to produce text like "pawn or dragon" at runtime. Given four pieces, the constructed text must be "pawn, dragon, turtle, or bishop". I had to deconstruct this "and" and "or" grammar logic for all languages.
  • Sometimes GT will replace five "b"s with six, or capitalize them, or in Russian replace them with a different letter altogether. So I automatically scan for these cases.
  • Apparently the Russian word for "chess bishop" is "elephant" (in Russian). I already have an elephant... so the Russian ChessCraft elephant is "mammoth" (in Russian). Automatic verification.
  • Some languages translate pawn, peon, or peasant into the same word. So easy-English sometimes used "farmer" and "labourer" to get unique names for those pieces. Automatic verification.
  • Some ChessCraft text requires special codes like "{0}", for example "The {0} promotes to a {1}". GT can mangle these codes into something like "{} 0". I automatically verify that all English codes exist in all translations.
  • I generate C# code from the spreadsheet, so that I can refer to any translation text as a compiled token, so I don't need to worry about hidden string typos in my code.

I'm very happy with the end result! We now have imperfect translations allowing native speakers of 11 languages to understand ChessCraft well enough to play it.

But WHY?

It is fairly cheap to submit a spreadsheet to a translation service. However I liked the challenge, and now I have the freedom to add more text, or languages, easily. If you'd like me to add your native language, please let me know! It is easy and free for me to add most languages now.

Complexity Estimates

From the FAQ:

Why are some boards hard, and some boards easy?

The difficulty of a board is a combination of two factors:

  • AI complexity. This is a measure of how hard it is for the computer to think about a board. The computer has a hard time thinking about boards with lots of tiles, with many powerful pieces, and turns with many possibilities.
  • Human complexity. This is a measure of how hard it is for a human to think about a board. Humans have a hard time thinking about strangely shaped boards, with many different types of custom pieces, pieces that move asymmetrically, and especially pieces that move unlike any classic chess piece.

So the hardest boards for a human to play are tiny boards, with weak, all custom pieces.

A new feature that I found incredibly interesting to implement are estimates on the AI complexity and human complexity, for any board or piece you create:

chesscraft screenshot

chesscraft screenshot

This should help people understand when they've created a real doozy.

Direction Tip

A friend of mine made a board with black pawns on the bottom, and white pawns on top. The pawns couldn't move! So I've added a cardinal direction tip in the editor. Knowing when to show which of the four arrows for any piece was a more complicated problem than you may think.

chesscraft screenshot

chesscraft screenshot

chesscraft screenshot

chesscraft screenshot

Device Speed

You can now see an estimate on the performance of your device. After playing some levels, find the "?" button next to the difficulty selection buttons. This uses benchmarks of how long it takes the AI to analyze built-in boards. If your device performance score is "32", this means my computer takes 32 seconds, and your device takes 100 seconds, to run the same AI code.

Next..?

Let me know what features you'd like next. I have plenty of ideas - tho I prioritize requests if lots of people ask.

Thanks for reading!

white griffin sprite