Chess for Android: UCI engine options

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Chess for Android: UCI engine options

Post by flok »

abik wrote: Wed Jun 19, 2019 6:14 pm
flok wrote: Wed Jun 19, 2019 11:05 amAlso: sometimes my program crashes. In adb logcat I saw a process faulting because of SIGABRT, probably my chess program. How can you debug such a thing? Is there a way to connect gdb to it or so? Last question: am I right that c-f-a automatically switches to an other chess engine when the one you're playing with crashes? That would be a bit confusing while e.g. debugging.
Note that logging can mean two things in this context. First, the centralized logging built in the Android framework (the one you inspect with adb logcat). Second, an engine specific log file written to "disk". The debugging version of Chess for Android (a version I use internally only for verification and debugging) uses the former heavily. The production version allows engines to use the latter (make sure to set enable the "Storage" permissions though, since the engine process will inherit from the GUI).
Ah good point! I had not thought of that. Thanks.
As for engine crashes, I am still thinking of a good way to relay the crash information back to the GUI (so far, a harder problem than I initially thought). I am happy to have a look if you are willing to share the binary and want to make progress. Other options are simply running the binary from the command line on the device (or on a similar Linux ARM device, such as the RaspberryPi).
For running it on a rpi: unfortunately that doesn't work as it is dynamically linked (altough I told it do static...)
The binary is at http://vanheusden.com/m-aart thanks in advance!!
It fails for: e2e4 c7c5 f2f4
Lastly, yes, on any engine crash, the GUI falls back to the built-in engine for safety (as indicated by the lack of engine output at the bottom window).
ok!
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Chess for Android: UCI engine options

Post by abik »

flok wrote: Wed Jun 19, 2019 6:45 pmThe binary is at http://vanheusden.com/m-aart thanks in advance!!
It fails for: e2e4 c7c5 f2f4
I think I know what it is. The engine is not robust against whitespace in the UCI command from the GUI (Chess for Android uses two spaces between moves). See the output below.

Code: Select all

# ./m-aart
uci
id name Micah
id author Folkert van Heusden
uciok
isready
readyok
position startpos moves e2e4 c7c5
go
info depth 1 score cp 61 nodes 31 time 0 nps 38993 pv g1f3
info depth 2 score cp -1 nodes 148 time 5 nps 24882 pv g1f3
info string beta cut-off after 0.962963 avg moves
bestmove g1f3
So far, so good! But then!

Code: Select all

position startpos moves e2e4  c7c5
terminating with uncaught exception of type std::out_of_range: basic_string
Hope this helps!
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Chess for Android: UCI engine options

Post by flok »

abik wrote: Wed Jun 19, 2019 6:57 pm Hope this helps!
Most definately! Thanks a lot! It now works :D
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Chess for Android: UCI engine options

Post by abik »

flok wrote: Wed Jun 19, 2019 7:34 pmMost definately! Thanks a lot! It now works :D
One is glad to be of service! Good luck with your engine. Can't wait to see a Micah vs. BikJump match!
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Chess for Android: UCI engine options

Post by flok »

abik wrote: Wed Jun 19, 2019 7:51 pm
flok wrote: Wed Jun 19, 2019 7:34 pmMost definately! Thanks a lot! It now works :D
One is glad to be of service! Good luck with your engine. Can't wait to see a Micah vs. BikJump match!
CfA v. Micah: 2-8
Unfortunately no PGNs - only the last is stored?
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Chess for Android: UCI engine options

Post by abik »

flok wrote: Wed Jun 19, 2019 9:19 pm CfA v. Micah: 2-8
Unfortunately no PGNs - only the last is stored?
All games of a tournament and/or match are stored, of course. By default in tour.pgn (regular games go to games.pgn), but you can change these names in settings to anything you want. Again, make sure to enable the "Storage" permission.

A victory against CfA built-in engine is nice, but how about the true BikJump?
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Chess for Android: UCI engine options

Post by flok »

abik wrote: Wed Jun 19, 2019 11:07 pm A victory against CfA built-in engine is nice, but how about the true BikJump?
Bikjump: 7
Micah: 3

Micah is running single core still
User avatar
flok
Posts: 481
Joined: Tue Jul 03, 2018 10:19 am
Full name: Folkert van Heusden

Re: Chess for Android: UCI engine options

Post by flok »

Aart,

From the chess programming wiki I understood that there's a chessbase-format for packaging chess-programs for Android and that C-f-A also supports this. Is this how it currently works? E.g. with the importing from sd-card feature etc? Or is there also an other way to package things? If so: can you give pointers to documentation how build for that?
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Chess for Android: UCI engine options

Post by abik »

flok wrote: Thu Jun 20, 2019 8:18 amMicah is running single core still
So is BikJump, by the way. The parallel implementation is still "pending"....
User avatar
abik
Posts: 819
Joined: Fri Dec 01, 2006 10:46 pm
Location: Mountain View, CA, USA
Full name: Aart Bik

Re: Chess for Android: UCI engine options

Post by abik »

flok wrote: Thu Jun 20, 2019 9:55 amFrom the chess programming wiki I understood that there's a chessbase-format for packaging chess-programs for Android and that C-f-A also supports this. Is this how it currently works? E.g. with the importing from sd-card feature etc? Or is there also an other way to package things? If so: can you give pointers to documentation how build for that?
Note that there are three common ways of "installing" an UCI or XBoard chess engines in the Android chess eco-system before it can be "imported".
  • The original way, where the GUI needs to do a one-time "install" of the binary from SD card
Then two new formats were introduced that avoid the "install" phase altogether, making the engine directly available for "import" by any GUI that supports this format. I actually was planning to update the chess programming Wiki with some more background information on all of this, but for now I have added URLs in this reply for your reference.

While developing, the original way is the simplest for the developer. But I would suggest to eventually package your engine in OEX format (you can read how-to in the link), since that is easier for the user.