XBoard for Mac: How to run Xiangqi?

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

XBoard for Mac: How to run Xiangqi?

Post by phhnguyen »

I have just downloaded XBoard for Mac. It runs well on my MacBook Pro, except I don't know how to run the variant Xiangqi: the button Xiangqi in dialog New variant (open by menu->File->New variant) is disable.

Don't know how to run this app from command line either :(

Thanks a lot for any help.

PS: I have a quick check by looking into app package contents, found Xingqi folder with many stuff such as svg files.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard for Mac: How to run Xiangqi?

Post by hgm »

If you run XBoard with an engine, it only allows you to select those variants that the engine can play. So the solution is to either run XBoard without engine, or select a Xiangqi engine. To run without engine would require the option -ncp on the command line that started XBoard. I don't know how it can be done in the OS X App, however. (I have no Mac, so I have never seen it in action.) Perhaps it contains a shortcut to start it in this mode.

If you have a Xiangqi engine (I don't know if one is included in the App, e.g. MaxQi), you can load it through the Load 1st Engine dialog, and this should enable the Xiangqi choice in the New Variant dialog, and even automatically select it if it is the only thing the engine plays.

This would allow you to play Xiangqi, but it would still keep using the Chess-like piece pictogram and checkered board. Which is probably not what you want. The displayed 'theme' has to be set separately, independently of the chosen variant, by specifying a ''piece-image directory and board textures, via the View->Board menu dialog. All that can also be controlled by command-line options, which could be combined in 'theme' settings files. There is a special version of the XBoard OSX App that has XBoard configured this way by default.
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: XBoard for Mac: How to run Xiangqi?

Post by phhnguyen »

Thanks a lot Muller,

Got the idea and then googled it. Now I can enable Xiangqi button in variant dialog by running command line:

open -a XBoard.app --args -ncp

It is OK for me since I can start working with Xiangqi. Just tried to open directly Xiangqi variant by:

open -a XBoard.app --args -variant xiangqi

But one error dialog popups and says: "Variant xiangqi not supported by Fairy-max 4.8V"

Any idea to improve or any way to open Xiangqi variant without using command line? Thanks
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: XBoard for Mac: How to run Xiangqi?

Post by phhnguyen »

Look like I have found the ini file of xboard. It is in Package contents with sub folder:

Contents/Resources/etc/xboard.conf

XBoard has reacted me after I changed something in that file :)

Still playing with it. I have not used Xboard for a while thus forgot how to configure it.
User avatar
hgm
Posts: 27790
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: XBoard for Mac: How to run Xiangqi?

Post by hgm »

I know Joshua supplies a version of the App that is already configured for Xiangqi. It is preferable to have a look at that, as I am not sure everything you would need to configure it yourself (board textures, SVG piece images, adapter for UCI and UCCI engines) is included in the standard App.

That the option -variant xiangqi does not work is only because the default engine Fairy-Max does not support that. So you would also have to specify another engine using -fcp (or -ncp). In fact since XBoard 4.8.0, when you load an engine without explicitly specifying a variant (so that the variant would default to 'normal', i.e. international Chess), and the engine does not play 'normal', XBoard will switch to the first variant that the engine mentions it does play. So for MaxQi (the dedicated Xiangqi derivative of Fairy-Max) there would not even be any need to mention the -variant, as xiangqi is all it plays. (I am not sure if MaxQi is included in the standard OSX App, however, or only in the Xiangqi pre-configured one.) MaxQi is just a toy engine, though; HaQiKi D is a lot stronger.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard for Mac: How to run Xiangqi?

Post by JoshPettus »

That xboard.conf file inside the app is the master conf file, do not edit that!
The user conf file overrides it!
to find your user config file, it's under /Users/*username/Library/Preferences/xboard-OSX.conf ( ~/Library can be reached by holding alt and going to the Go Menu in the finder, library will appear)
(I should probably add all this to the comment section of the master file)

Even in the basic xboard.app version, I include elephanteye, haqikid and maxqi engines. Just go to Load First engine, double click on the #Variant Engines in the menu on the left to bring up those engines, and choose one of them. A xiangqi game will start right up. (defaults to the western board) You can also go into the Board Menu double click #Oriental Boards in the menu and choose a wooden or standard xiangqi board.

The special XboardXQ.app is mostly the same except it removes all the non xiangqi fluf, makes Xiangqi the default variant, tweaks the UI a bit to show red instead of white and a few other minor tweaks, and makes WB2UCI the default UCI adapter as polyglot doesn't understand Xiangqi.

Unfortunately most xiangqi engines available are windows only (i've tried compiling a few to OSX but was never once successful). Fortunately most of these are 32bit and can be run in wine. Easiest and cleanest way is to download this wineskin engine

http://www.mediafire.com/download/5dkqx ... ker.tar.7z (it was designed for something else, but will work for this easily)

extract it completely so you get wswine.bundle. Right click on it ans select "open contents". under the bin folder is the wine executable itself.

To launch your windows engine and wine, for -fcp have:

"/dir/whatever/wswine.bundle/bin/wine /dir/whatever/XiangqiEngine.exe"

You can also put the launch line in a script (textfile with no extention) and load that script like a native engine.

The engine might fail the first time while wine configures, but the next launch should be fine.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard for Mac: How to run Xiangqi?

Post by JoshPettus »

Forgot to mention, both Xboad.app and Xboard.Xq.app include UCI2WB as a UCCI adapter. When loading a new engine, it can be activated by checking the UCCI/USI checkbox in the "Load New First/Second Engine" menus (You don't have to do this for the engines already in the list, as they are already configured.)

Also thanks for mentioning "open -a Xboard --args". I completely forgot about that and is a great way to get user commands to the app. :)
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: XBoard for Mac: How to run Xiangqi?

Post by phhnguyen »

Thanks Josh!!!
JoshPettus wrote:That xboard.conf file inside the app is the master conf file, do not edit that!
I have to re-install to recover it :(
JoshPettus wrote: Even in the basic xboard.app version, I include elephanteye, haqikid and maxqi engines. Just go to Load First engine, double click on the #Variant Engines in the menu on the left to bring up those engines, and choose one of them. A xiangqi game will start right up. (defaults to the western board) You can also go into the Board Menu double click #Oriental Boards in the menu and choose a wooden or standard xiangqi board.
Nice and easy way to start Xiangqi!

However, I cannot save the new variant/engine. Each time Xboard restarts, it is back to use chess but Xiangqi. Only graphics is still from Xiangqi (it is western chess but using Xiangqi board and pieces)
JoshPettus wrote: The special XboardXQ.app is mostly the same except it removes all the non xiangqi fluf, makes Xiangqi the default variant, tweaks the UI a bit to show red instead of white and a few other minor tweaks, and makes WB2UCI the default UCI adapter as polyglot doesn't understand Xiangqi.
Silly question: How can I have XboardXQ.app?

I have downloaded XBoard_4.8.0d_OSX_Intel.dmg, after clicking on that, the installing window shows only XBoard.app (and some links used to connect to FICS, ICC, VICS).

Thanks again
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: XBoard for Mac: How to run Xiangqi?

Post by JoshPettus »

Yeah as HGM said, the engine dictates to xboard what games can be played, and the default engine which loads on startup "fairymax" doesn't play xiangqi.

You would defiantly enjoy the the Xq version of the app.
It's on the download thread, first post scroll down. :)
but here is the link
http://www.mediafire.com/download/gd76u ... _Intel.dmg
User avatar
phhnguyen
Posts: 1434
Joined: Wed Apr 21, 2010 4:58 am
Location: Australia
Full name: Nguyen Hong Pham

Re: XBoard for Mac: How to run Xiangqi?

Post by phhnguyen »

JoshPettus wrote:Yeah as HGM said, the engine dictates to xboard what games can be played, and the default engine which loads on startup "fairymax" doesn't play xiangqi.

You would defiantly enjoy the the Xq version of the app.
It's on the download thread, first post scroll down. :)
but here is the link
http://www.mediafire.com/download/gd76u ... _Intel.dmg
Thanks again!!!

Yes, love the Xq version. It runs so well!

Just report a tiny error: I cannot open pgn file by selecting "Open with" from popup menu over that file, even I have tried to select XBoardXq.app - it becomes grey when XBoard.app is still OK / selectable. I can load that pgn file from menu/file/load game but have to spend too many steps to access my files. Not sure but app's screen flicks after loading pgn file - will spend more time to check that.