Page 1 of 1

any free tablebase web service?

Posted: Fri Sep 09, 2011 11:45 pm
by casaschi
Hello,

is anyone aware of any free tablebase web service that I could use in an open source GPL project (an extension for google chrome)?

What I'm looking for is a service that I could query (with javascript from my extension) sending a probe request with a FEN string as a parameter and receiving back the tablebase lookup result (mate in X, draw, position not found, error).

There's something here http://www.lokasoft.nl/tbapi.aspx but I could not make the SOAP request work with javascript. Other services like the one at the shredder website only allow manually entering the FEN string.

Thanks.

Re: any free tablebase web service?

Posted: Sun Sep 11, 2011 6:42 am
by tmokonen
Would something like the JavaScript SOAP client prove useful to you?

http://www.codeproject.com/KB/ajax/Java ... lient.aspx

Re: any free tablebase web service?

Posted: Sun Sep 11, 2011 7:18 am
by casaschi
tmokonen wrote:Would something like the JavaScript SOAP client prove useful to you?

http://www.codeproject.com/KB/ajax/Java ... lient.aspx
I already tried using this library to access the lokasoft server, but I could not get it to work (and it's not a cross domain issue since google chrome extensions are allowed cross domain requests); I posted a note for the author of the library but I got no reply.

Re: any free tablebase web service?

Posted: Sun Sep 11, 2011 10:51 pm
by casaschi
Finally managed to manually build a SOAP query for the lokasoft server.
Posting the code below if anyone is interested.

Still it would be great to have an alternative, possibly supporting 6 men tables (the lokasoft server seems limited to 5 men).

Code: Select all

<script>

function probeFen&#40;fenString&#41; &#123;
   probeTablebaseXMLHTTPRequest = new XMLHttpRequest&#40;);
   probeTablebaseXMLHTTPRequest.open&#40;"POST", "http&#58;//www.lokasoft.nl/tbweb/tbapi.asp", true&#41;;
   probeTablebaseXMLHTTPRequest.setRequestHeader&#40;"Content-Type", "text/xml; charset=utf-8");
   probeTablebaseXMLHTTPRequest.setRequestHeader&#40;"SOAPAction", "http&#58;//lokasoft.org/action/TB2ComObj.ProbePosition");
   probeTablebaseXMLHTTPRequest.onreadystatechange = function&#40;) &#123;
      if &#40;probeTablebaseXMLHTTPRequest.readyState == 4&#41; &#123;
         if &#40;probeTablebaseXMLHTTPRequest.status == 200&#41; &#123;
            if &#40;matches = probeTablebaseXMLHTTPRequest.responseText.match&#40;/<SOAP-ENV&#58;Body><m&#58;ProbePositionResponse xmlns&#58;m="http&#58;\/\/lokasoft.org\/message\/"><Result>(&#91;0-9M-&#93;*)<\/Result><\/m&#58;ProbePositionResponse>/)) &#123;
               alert&#40;matches&#91;1&#93;);
            &#125;
         &#125;
      &#125;
   &#125;;
   request = '<SOAP-ENV&#58;Envelope xmlns&#58;ns3="http&#58;//www.w3.org/2001/XMLSchema" xmlns&#58;SOAP-ENC="http&#58;//schemas.xmlsoap.org/soap/encoding/" xmlns&#58;ns0="http&#58;//schemas.xmlsoap.org/soap/encoding/" xmlns&#58;ns1="http&#58;//lokasoft.org/message/" xmlns&#58;ns2="http&#58;//schemas.xmlsoap.org/soap/envelope/" xmlns&#58;xsi="http&#58;//www.w3.org/2001/XMLSchema-instance" xmlns&#58;SOAP-ENV="http&#58;//schemas.xmlsoap.org/soap/envelope/" SOAP-ENV&#58;encodingStyle="http&#58;//schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV&#58;Header/><ns2&#58;Body><ns1&#58;ProbePosition><fen xsi&#58;type="ns3&#58;string">' + fenString + '</fen></ns1&#58;ProbePosition></ns2&#58;Body></SOAP-ENV&#58;Envelope>';
   probeTablebaseXMLHTTPRequest.send&#40;request&#41;;
&#125;

probeFen&#40;"8/8/8/8/1p2P3/1k1KP3/8/8 w - - 0 1");

</script>

Re: any free tablebase web service?

Posted: Mon Sep 12, 2011 1:24 am
by Gino Figlio
This site has the 6-piece tablebases:

http://www.k4it.de/index.php?topic=egtb&lang=en

Re: any free tablebase web service?

Posted: Mon Sep 12, 2011 1:29 am
by casaschi
Gino Figlio wrote:This site has the 6-piece tablebases:

http://www.k4it.de/index.php?topic=egtb&lang=en
True, but they offer only a web browser interface.
Instead, I need a programmer interface for my google chrome extension to get the assessment of a given FEN position using javascript.

Re: any free tablebase web service?

Posted: Mon Sep 12, 2011 1:35 am
by Gino Figlio
I don't have the background to understand what you need. I thought you could create a script to query the site

Re: any free tablebase web service?

Posted: Mon Sep 12, 2011 3:08 am
by tano-urayoan
What about this site, http://chessok.com/?page_id=361 ? It has 6 pieces tablebases.

Re: any free tablebase web service?

Posted: Mon Sep 12, 2011 7:59 am
by casaschi
tano-urayoan wrote:What about this site, http://chessok.com/?page_id=361 ? It has 6 pieces tablebases.
This one also offers only a web browser interface without a progamming inerface.
Looking in details how that page is built, there's a hook that could be used by a javascript program, however if chessok does not formally offer a public/free API I don't think that hook could be used without permission.