Adapter for non-standard chess engine to Winboard

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Adapter for non-standard chess engine to Winboard

Post by Carey »

Im working on an old chess program that does commands and output in its own format and I'm wanting to try and convert that to work with Winboard.

For a variety of reasons, modifying the original source is not the best choice. First, it would kind of violate the goal of keeping the original source as close to the original as possible. Second, the I/O is scattered through out the program and is not easily modified. Third... Well, you get the idea.

So I figured a translator would be needed. Let it convert the winboard commands into something the program understands, and filter the output into something winboard can handle.

I first consider grafting a small section of code right into the program and let it redirect the I/O from a forked copy of itself. That would let me build the adapter right into the program itself. The original copy would be running the adapter code to convertr to/from winboard, while the second spawned copy would be blissfully unaware anything was going on and keep doing things via stdin / stdout.

But it doesn't appear that GNU C (which the chess program is hardwired for) provides a somewhat generic way to do this.

And if I can help it, I'd rather not require a bunch of additional libraries etc. (Plus there's always the licensing issue. I can't (wont!) put GPL etc. code into somebody else's program.)


That leaves an external adapter / translator. Like polyglot is for UCI->WB.

Polyglot is a little big and UCI specific to work with for my situation. Is there any smaller or more generic adapter that I might be able to modify?

I'm expecting it would be little more than a simple filter / translator. I can filter out most of the stuff the program would print out, and only a limited number of winboard commands are really needed to play.

(With my interest in old programs, it's a shame there isn't a generic adapter that works using modifiable scripts & pattern rules.)

It would need to be platform neutral, too. It'll have to work under Mac and Windows.


Any ideas?
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Adapter for non-standard chess engine to Winboard

Post by hgm »

I have written minimal adapters to have the microMax and Toledo nanochess stand-alone versions play under WinBoard, and to play engines using Qianhong protocol under WinBoard. The latter is on my website ( http://home.hccnet.nl/h.g.muller/XQ.html ), look for QH2WB.

I am not sure where I have the Max2WB, I could look it up if you are interested. The two are derivatives of each other anyway.

InBetween is currently the closest you can get to a generic adapter.
Michel
Posts: 2272
Joined: Mon Sep 29, 2008 1:50 am

Re: Adapter for non-standard chess engine to Winboard

Post by Michel »

Polyglot is a little big and UCI specific to work with for my situation
The I/O part is well isolated. It is implemented for both windows and linux
with a common interface. It includes an event loop. Look at pipex.h and pipex_posix,c and pipex_win32.c.

It should be easy to adapt to any other kind of adapter.
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: Adapter for non-standard chess engine to Winboard

Post by Carey »

hgm wrote:I have written minimal adapters to have the microMax and Toledo nanochess stand-alone versions play under WinBoard, and to play engines using Qianhong protocol under WinBoard. The latter is on my website ( http://home.hccnet.nl/h.g.muller/XQ.html ), look for QH2WB.

I am not sure where I have the Max2WB, I could look it up if you are interested. The two are derivatives of each other anyway.
I think I may see about adapting your code to my purposes. Assuming it'll work with a Mac & GCC.

Do you mind if I use it as a starting point? I'll give you credit, of course.
InBetween is currently the closest you can get to a generic adapter.
I'm not familiar with that and I don't see anything right away on the web about it.
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: Adapter for non-standard chess engine to Winboard

Post by Carey »

Michel wrote:
Polyglot is a little big and UCI specific to work with for my situation
The I/O part is well isolated. It is implemented for both windows and linux
with a common interface. It includes an event loop. Look at pipex.h and pipex_posix,c and pipex_win32.c.

It should be easy to adapt to any other kind of adapter.
I think I'm going to give HGM's code a try first. it's fairly small and I might be able to adapt it for what I need more easily.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Adapter for non-standard chess engine to Winboard

Post by hgm »

The QH2WB code is free software and you can do with it whatever you want. You don't even have to give me credit. It was just a quick hack to make Qianhong 'plugins' work under WinBoard, and when you would remove the specifics of the Qianhong protocol and adapt it to another protocol I doubt if there would even be something left of the code that would be copyightable. :wink:

I used gcc to develop it, and it should run fine on Mac. In fact it is Windows that causes the biggest problem, as I use Unix-style system calls which do not work under Windows with gcc without the cygwin1.dll.
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: Adapter for non-standard chess engine to Winboard

Post by Carey »

hgm wrote:The QH2WB code is free software and you can do with it whatever you want. You don't even have to give me credit. It was just a quick hack to make Qianhong 'plugins' work under WinBoard, and when you would remove the specifics of the Qianhong protocol and adapt it to another protocol I doubt if there would even be something left of the code that would be copyightable. :wink:
Thanks for the permission. I'll go ahead and give you credit anyway. Assuming I manage to get it working.

And no, there probably wont be much left of it by the time I modify it. :)
I used gcc to develop it, and it should run fine on Mac. In fact it is Windows that causes the biggest problem, as I use Unix-style system calls which do not work under Windows with gcc without the cygwin1.dll.
Really... I'm using Mingw, so that might be a problem. I don't want to have to install Cygwin just to work on this.

I'll have to check into this.

Thanks for the extra info / warning.

Carey
Christopher Conkie
Posts: 6073
Joined: Sat Apr 01, 2006 9:34 pm
Location: Scotland

Re: Adapter for non-standard chess engine to Winboard

Post by Christopher Conkie »

Sorry to bother you Carey with a tangential question.

Is your site coming back? The one with all the oldies on it. It can be viewed in the Internet Archive which is not ideal, but at least it's something.

Christopher
Carey
Posts: 313
Joined: Wed Mar 08, 2006 8:18 pm

Re: Adapter for non-standard chess engine to Winboard

Post by Carey »

Christopher Conkie wrote:Sorry to bother you Carey with a tangential question.

Is your site coming back? The one with all the oldies on it. It can be viewed in the Internet Archive which is not ideal, but at least it's something.

Christopher
Google changed their policy about allowing sites to have Javascript. They claimed it was for safety, but my guess is it allowed people to do their own designs and that didn't fit into google's desire to standardize the web sites using their web builder.

My site was entirely javascript. It was based on TiddlyWiki, which is a javascript wiki kind of thing.

So my site was no longer allowed.


I wasn't in any hurry to find some other free site that could host it because I didn't think anybody really cared.

I figured the few who did cared probably already got all of it, and I haven't found anything new in the last year or so. (I haven't had the energy / urge to keep hunting. I know of two classic programs the authors are slowly trying to get working, but they aren't ready yet.)

I can't put the site on just any free hosting place because most of them can't handle the complicated javascript. They usually try to rewrite it so they can put ads or tracking statistics etc.

Plus, some sites have policies about hosting certain kinds of iles, and other conditions.


I would have really prefered to a real wiki kind of site. That way people could add their own info about old programs and so on. Turn it into a real community effort. Kind of like how the ChessProgramming wiki is doing.

But those sites are very restrictive about what programs can be stored and they put their own license on any attached files. Which certainly wouldn't work considering the programs I'm posting are distributed with the author's permission but are still very copyrighted by them.
Ron Murawski
Posts: 397
Joined: Sun Oct 29, 2006 4:38 am
Location: Schenectady, NY

Re: Adapter for non-standard chess engine to Winboard

Post by Ron Murawski »

Carey wrote:
Christopher Conkie wrote:Sorry to bother you Carey with a tangential question.

Is your site coming back? The one with all the oldies on it. It can be viewed in the Internet Archive which is not ideal, but at least it's something.

Christopher
Google changed their policy about allowing sites to have Javascript. They claimed it was for safety, but my guess is it allowed people to do their own designs and that didn't fit into google's desire to standardize the web sites using their web builder.

My site was entirely javascript. It was based on TiddlyWiki, which is a javascript wiki kind of thing.

So my site was no longer allowed.


I wasn't in any hurry to find some other free site that could host it because I didn't think anybody really cared.

I figured the few who did cared probably already got all of it, and I haven't found anything new in the last year or so. (I haven't had the energy / urge to keep hunting. I know of two classic programs the authors are slowly trying to get working, but they aren't ready yet.)

I can't put the site on just any free hosting place because most of them can't handle the complicated javascript. They usually try to rewrite it so they can put ads or tracking statistics etc.

Plus, some sites have policies about hosting certain kinds of iles, and other conditions.


I would have really prefered to a real wiki kind of site. That way people could add their own info about old programs and so on. Turn it into a real community effort. Kind of like how the ChessProgramming wiki is doing.

But those sites are very restrictive about what programs can be stored and they put their own license on any attached files. Which certainly wouldn't work considering the programs I'm posting are distributed with the author's permission but are still very copyrighted by them.
You are welcome to create as many chess-related pages as you like at the Computer-Chess Wiki
http://computer-chess.org/
The default setup is totally public and anyone can edit the pages. On request I can set up pages where only you (and I) can edit them.

Ron