JSUCI 1.0 - connect javascript chess engines to UCI

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

Moderators: hgm, Rebel, chrisw

Edmund
Posts: 670
Joined: Mon Dec 03, 2007 3:01 pm
Location: Barcelona, Spain

JSUCI 1.0 - connect javascript chess engines to UCI

Post by Edmund »

Javascript is getting a more and more versatile programming language. Particularly the latest javascript engines as well as new standards (HTML5) allow for high performance applications to be written.

Javascript chess engines are interesting, because they are easy to integrate and thus very multifunctional. E.g. just imagine we add a button to analyze positions on the analysis board in this forum, or on TCEC, etc.

There already exist a variety of javascript chess engines that run in the browser and are played on their native guis. In an attempt to coordinate these individual efforts and to promote future developments I have created a JS to UCI port. It is an application that on the one hand communicates with the GUI and on the other hand is a Javascript Engine that can interpret *.js files. The code is very simple and basically just relays messages without any error checking. For the JS interpretation I used the open source V8 engine developed by Google.

This way it will be much easier to compare javascript chess engines (and even match them with standard engines) and furthermore it will become more feasable to use these tools outside their native environment and make them portable.

You find the download to the JSUCI package here: https://sourceforge.net/projects/jsuci/

So far I have written a wrapper for the open source javascript chess engine p4wn by Douglas Bagnall to give an example. (on a side note: I would like to contact the author, but couldn't find him registered on this board, has anyone got means to contacting Douglas?). The engine is simple and only accepts "go depth n" commands.
To run p4wn, you have to launch the application with the path to the loader js file in the command line (e.g. "jsuci_1.exe p4wn\p4wn_loader.js")

Now some technical notes:
The communication with the engines relies on the new HTML5 standard for Web Workers. The engines are started as individual threads and then UCI commands are sent over the default pipes.


Does there exist any interest in this new tool? As a tester? Engine programmer? Others?


Image
Norbert Raimund Leisner
Posts: 1643
Joined: Tue May 20, 2008 4:57 pm
Location: Augsburg - Germany

Re: JSUCI 1.0 - connect javascript chess engines to UCI

Post by Norbert Raimund Leisner »

Java Chess Protocol Interface is a similar project by Phokham Nonava:
http://sourceforge.net/projects/jcpi/
https://github.com/fluxroot/jcpi
http://fluxchess.com/jcpi/download

Douglas Barnell´s websites:
http://p4wn.sourceforge.net/
http://sourceforge.net/projects/p4wn/files/
http://halo.gen.nz/db/
http://halo.gen.nz/index-2004.html

Another port from Javascript to XBoard/WinBoard would be for CECP-protocol compatible engines surely an option.
(Perhaps later for HGM´s WinBoard 4.7.3a-GUI)

Norbert
Edmund
Posts: 670
Joined: Mon Dec 03, 2007 3:01 pm
Location: Barcelona, Spain

Re: JSUCI 1.0 - connect javascript chess engines to UCI

Post by Edmund »

Norbert Raimund Leisner wrote:Java Chess Protocol Interface is a similar project by Phokham Nonava:
http://sourceforge.net/projects/jcpi/
https://github.com/fluxroot/jcpi
http://fluxchess.com/jcpi/download

Douglas Barnell´s websites:
http://p4wn.sourceforge.net/
http://sourceforge.net/projects/p4wn/files/
http://halo.gen.nz/db/
http://halo.gen.nz/index-2004.html

Another port from Javascript to XBoard/WinBoard would be for CECP-protocol compatible engines surely an option.
(Perhaps later for HGM´s WinBoard 4.7.3a-GUI)

Norbert
Thank you for the information on Douglas Barnell, Norbert!

Java is not the same as Javascript. Javascript is only a Browserlanguage. This means it is not required to use any plugins to execute it (as would be with Java in the Browser).
Gerd Isenberg
Posts: 2250
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: JSUCI 1.0 - connect javascript chess engines to UCI

Post by Gerd Isenberg »

gladius
Posts: 568
Joined: Tue Dec 12, 2006 10:10 am
Full name: Gary Linscott

Re: JSUCI 1.0 - connect javascript chess engines to UCI

Post by gladius »

Very cool! I will definitely give this a shot with GarbochessJS. Thanks for putting this together :).
Edmund
Posts: 670
Joined: Mon Dec 03, 2007 3:01 pm
Location: Barcelona, Spain

Re: JSUCI 1.0 - connect javascript chess engines to UCI

Post by Edmund »

gladius wrote:Very cool! I will definitely give this a shot with GarbochessJS. Thanks for putting this together :).
That is great news, Gary!
Looking forward to seeing Garbochess JS run in console mode. I already enjoy a lot playing it on your native board. It will be interesting to see its ELO rating as compared to the C++ competitors.
If there is anything unclear with the port, please let me know!
phenri
Posts: 284
Joined: Tue Aug 13, 2013 9:44 am

Re: JSUCI 1.0 - connect javascript chess engines to UCI

Post by phenri »

sorry but I do not see any exe file in package.
Edmund
Posts: 670
Joined: Mon Dec 03, 2007 3:01 pm
Location: Barcelona, Spain

Re: JSUCI 1.0 - connect javascript chess engines to UCI

Post by Edmund »

My bad, sorry.
I uploaded the wrong file.
Please check again now.
phenri
Posts: 284
Joined: Tue Aug 13, 2013 9:44 am

Re: JSUCI 1.0 - connect javascript chess engines to UCI

Post by phenri »

Edmund wrote:My bad, sorry.
I uploaded the wrong file.
Please check again now.
Thanks, but now i am getting pains to compile it
jsuci.cpp:2:16: fatal error: v8.h: No such file or directory
What is the right command to compile? and where I can find v8.h ?
Edmund
Posts: 670
Joined: Mon Dec 03, 2007 3:01 pm
Location: Barcelona, Spain

Re: JSUCI 1.0 - connect javascript chess engines to UCI

Post by Edmund »

phenri wrote:
Edmund wrote:My bad, sorry.
I uploaded the wrong file.
Please check again now.
Thanks, but now i am getting pains to compile it
jsuci.cpp:2:16: fatal error: v8.h: No such file or directory
What is the right command to compile? and where I can find v8.h ?
the source depends on Google V8 Javascript Engine
https://code.google.com/p/v8/

jsuci is easy to compile, once you manage to get V8 running. There are good build instructions in the v8 wiki (https://code.google.com/p/v8/wiki/BuildingWithGYP). jsuci is very similar in its functionality to the "shell"-sample provided in the V8 package.