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
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(fenString) {
probeTablebaseXMLHTTPRequest = new XMLHttpRequest();
probeTablebaseXMLHTTPRequest.open("POST", "http://www.lokasoft.nl/tbweb/tbapi.asp", true);
probeTablebaseXMLHTTPRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
probeTablebaseXMLHTTPRequest.setRequestHeader("SOAPAction", "http://lokasoft.org/action/TB2ComObj.ProbePosition");
probeTablebaseXMLHTTPRequest.onreadystatechange = function() {
if (probeTablebaseXMLHTTPRequest.readyState == 4) {
if (probeTablebaseXMLHTTPRequest.status == 200) {
if (matches = probeTablebaseXMLHTTPRequest.responseText.match(/<SOAP-ENV:Body><m:ProbePositionResponse xmlns:m="http:\/\/lokasoft.org\/message\/"><Result>([0-9M-]*)<\/Result><\/m:ProbePositionResponse>/)) {
alert(matches[1]);
}
}
}
};
request = '<SOAP-ENV:Envelope xmlns:ns3="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://lokasoft.org/message/" xmlns:ns2="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><ns2:Body><ns1:ProbePosition><fen xsi:type="ns3:string">' + fenString + '</fen></ns1:ProbePosition></ns2:Body></SOAP-ENV:Envelope>';
probeTablebaseXMLHTTPRequest.send(request);
}
probeFen("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
Re: any free tablebase web service?
Posted: Mon Sep 12, 2011 1:29 am
by casaschi
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
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.