front-ending

Discussion of chess software programming and technical issues.

Moderators: bob, hgm, Harvey Williamson

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
smcracraft
Posts: 706
Joined: Wed Mar 08, 2006 7:08 pm
Location: Orange County California
Full name: Stuart Cracraft
Contact:

front-ending

Post by smcracraft » Tue May 05, 2020 12:30 am

Hi.

I want to put a quick front-end on Talish but don't want to conform to "complex front-end-languages".

All I want is a front-end system which handles

new
go
time <milliseconds per move>
e2e4
e7e5
g1f3
:
e1g1

quit

and that's it.

Is there anything which fits the bill?

The platform is Apple Catalina.

Thanks ahead everybody.

Dann Corbit
Posts: 11160
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: front-ending

Post by Dann Corbit » Tue May 05, 2020 12:51 am

A perfect hash springs to mind.
Ultra fast
Ultra simple
Extensible to new keywords
Enumerating every move would be tedious and I probably would not do it that way.

Personally, I would at least write a simple state machine, because state is implied in parsing chess commands.

On the other hand, I expect someday the program will grow. When that does happen, you may wish you had implemented a formal grammar.

On the other, other hand, nobody does that. In fact the only serious efforts I have seen at chess parsing are David Barnes' eco tool and the spirit parser which really just parse PGN and EPD and not game commands. There is also a java parser for PGN somewhere, but I forget the name of it.

I think what ought to be done is to merge the Winboard/Xboard protocol and the UCI protocol and have a single formal grammar for them. Then the client and server parts of chess programming would be a snap and nobody would have to furrow their brow over it.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

jdart
Posts: 3934
Joined: Fri Mar 10, 2006 4:23 am
Location: http://www.arasanchess.org

Re: front-ending

Post by jdart » Tue May 05, 2020 12:54 am

Dann Corbit wrote:
Tue May 05, 2020 12:51 am
I think what ought to be done is to merge the Winboard/Xboard protocol and the UCI protocol and have a single formal grammar for them. Then the client and server parts of chess programming would be a snap and nobody would have to furrow their brow over it.
That's a fine idea, but they are incompletely specified at present, and so different implementors have adopted different behaviors. Even if that were tidied up, you'd have to live with some of the quirks of existing implementations for quite a while.

Dann Corbit
Posts: 11160
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: front-ending

Post by Dann Corbit » Tue May 05, 2020 1:24 am

Along those lines, various tool vendors have started to decorate PGN with things like time usage, book usage, eval, depth, etc. and everyone seems to do it differently.

If there were ever a good time for a new formal specification, it is today.
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

User avatar
hgm
Posts: 24586
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: front-ending

Post by hgm » Tue May 05, 2020 8:25 am

I don't get it. This seems something you would write from scratch in under 5 minutes. Just recognize four keywords with strcmp, and a move by the fact that the second character is a digit. What could be quicker than that? Posting the message with the question probably already took longer.

Dann Corbit
Posts: 11160
Joined: Wed Mar 08, 2006 7:57 pm
Location: Redmond, WA USA
Contact:

Re: front-ending

Post by Dann Corbit » Tue May 05, 2020 10:38 am

He has written chess engines before, I think he was hoping there is a ready made utility for chess engine interface parsing he could just clip on
Taking ideas is not a vice, it is a virtue. We have another word for this. It is called learning.
But sharing ideas is an even greater virtue. We have another word for this. It is called teaching.

User avatar
hgm
Posts: 24586
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: front-ending

Post by hgm » Tue May 05, 2020 11:38 am

For a protocol that is not standard?

Of course there are plenty of CECP or UCI protocol drivers that you can copy from other engines. But it is never without work. He wants to reads moves, and presumably he wants to do more with those than just concluding that they are pairs of letters a-h and digits 1-8. So the moves must be somehow converted to an internal format the rest of his software can use.

smcracraft
Posts: 706
Joined: Wed Mar 08, 2006 7:08 pm
Location: Orange County California
Full name: Stuart Cracraft
Contact:

Re: front-ending

Post by smcracraft » Tue May 05, 2020 4:06 pm

Hey, didn't mean to be controversial.

Just wanted to play Talish on a screen rather than on a physical board.

odomobo
Posts: 70
Joined: Thu Jul 05, 2018 11:09 pm
Location: Chicago, IL
Full name: Josh Odom

Re: front-ending

Post by odomobo » Tue May 05, 2020 9:13 pm

As much as it's a bad idea to fragment protocols for any technology, I think there's room for a separate minimalistic protocol separate from CECP and UCI. Chiefly, it would implement only the minimum required instructions to play a game of chess, and it would be synchronous.

The purpose for this is that someone developing a new engine could start playing against it with under an hour of additional work in frontend logic (possibly under 10 minutes for an efficient coder).

The downside of having a synchronous protocol is that the only way to interrupt the engine is to kill the process. However, I think this is necessary for a minimal protocol.

Other than what smacraft listed, the only recommendation I have is that anything coming from the engine starting with # is to be ignored, as this debugging info is useful during the starting stages of developing an engine.

Anyhow, with such a protocol, it should be possible to write a wrapper around UCI and CECP, to make this protocol work with existing frontend applications. However, FEN will not work unless someone could create an FEN-to-PGN solver, and that still would only work for positions which are reachable in a real game.

User avatar
hgm
Posts: 24586
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: front-ending

Post by hgm » Wed May 06, 2020 6:49 am

The stand-alone version of micro-Max uses such a minimalistic protocol: it only accepts moves, and to make it think and play a move you have to send it an empty line. After every input it responds with an ascii board. But this could of course be suppressed, and after thinking it could print its move instead. To start a new game, just restart the program.

If you would abandon the requirement that input moves must be legal, it becomes much easier to set up a given position. Just move pieces that are not yet where they are supposed to be to the square where they should go. If that square is occupied, just move the occupant to an empty square first. You start with capturing all pieces that are not needed.

Post Reply