Looking for C developper

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

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

Re: Marseillais Chess

Post by hgm »

Sven Schüle wrote: Well, I tried do discuss what should be done in general to implement that variant. You focus on FairyMax, no problem for me. As I said: interests are different. But then we also do not discuss the same thing. You may be right about what needs to be modified in FairyMax on that one afternoon that you want to spend for it. I have no doubt that you can do it. It just won't have much in common with the way I would go, it would be just a couple of "hacks". That's fine for me, everyone does it the way he likes best :-)
Well, we will see what in the end plays stronger: your engine or Marseillaise-Max! :wink:
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Marseillais Chess

Post by Sven »

hgm wrote:Comma-separated.

As it was implemented a bit as a kludge, it uses an asymmetric way to communicate the moves engine->GUI and GUI->engine, though. The engine would always send the various legs in separate 'move' commands, the non-final legs suffixed by a comma. The GUI sends them in a single line.

When the GUI is entirely unaware of the game rules (the default rules for variant multi are those of orthodox Chess...), the user would have to indicate whether an entered move is the final leg or not. He can do this by keeping Ctrl pressed on non-final legs, which suppresses stm change (just like a comma suffix suppresses stm change on wtext moves). This turned out to be quite inconvenient (because you tend to forget it).

So the later versions of the Alien Edition do accept engine help for this, through the 'highlight' command. In response to the 'lift SQR' command, send by the GUI when the user grabs or selects a piece with the mouse on SQR, the engine can answer with a 'color FEN' to indicate which squares the piece can be released on. The GUI uses that for legality checking (it won't accept you releasing the piece on a non-colored square), and some colors have special meaning (e.g. magenta triggers the promotion popup). In particular, releasing the piece on a cyan square suppresses the stm change, and thus allows the user to enter another leg. As the moved piece stays selected in this case, WinBoard will immediately send a new 'lift command', and the engine can respond with a 'highlight' command for the second leg of that same piece. That is convenient for Lion moves, but perhaps a bit confusing for Marseillaise, where you would usually select another piece (which through the lift-highlight protocol would then highlight its moves, this time not in cyan, but in yellow/red, because now they are turn-terminating moves).

So basically a Marseillaise engine would have to respond to 'lift' command with highlighting the moves of the piece in cyan on the first leg, and in yellow/red on the second. That way the user does not have to worry about whose turn it is anymore. The engine can enforce any kind of progressive variant this way. In fact there is no reason anymore to have a special variant multi that enables multi-leg moves. The engine can enable them whenever it wants. (But only when legality testing is off. With legality testing on, highlight commands are ignored.)
How do I tell WB Alien Edition to play a "multi" game with my engine? If I start the GUI and select File->New Variant then only "Normal" is offered as an option, and a lot of other variants are displayed in grey, where "multi" is not among them ... I know, it's just a stupid "Alien beginner's question". I vaguely remember that I already used that interface a couple of years ago when I started writing a checkers engine, but this knowledge has left the cache ;-)

EDIT: In fact WB rejects "multi" after 'feature variants="normal","multi"'. I am certainly doing something wrong ...

(And where can I find a proper description of the lift/highlight/... command syntax?) EDIT: found the description.
User avatar
hgm
Posts: 27837
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Marseillais Chess

Post by hgm »

I did not make a radio button for variant multi because it was intended as a 'catch-all' variant with unspecified rules. So in general a lot of configuring would be needed (providing initial position and participating pieces, prehaps board size adjustment) to make it into something specific, which merely pressing a button would not provide. So the idea was that there would be some settings file with options, which then would also specify "-variant multi" as one of the settings. So WinBoard should react to the command-line option for selecting variant multi.

What do you mean with "WinBoard rejects variant multi"? It does not allow you to specify it with the -variant option from the command line? Note that you posted a wrong syntax of the variant feature: quotes should only surround the entire list, not individual variant names:

feature variants="normal,multi"

If the engine really prints it as you posted it here, WinBoard would stop parsing the feature after the first closing quote, and ignore the rest, which could explain the trouble you are having.
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Marseillais Chess

Post by Sven »

hgm wrote:I did not make a radio button for variant multi because it was intended as a 'catch-all' variant with unspecified rules. So in general a lot of configuring would be needed (providing initial position and participating pieces, prehaps board size adjustment) to make it into something specific, which merely pressing a button would not provide. So the idea was that there would be some settings file with options, which then would also specify "-variant multi" as one of the settings. So WinBoard should react to the command-line option for selecting variant multi.

What do you mean with "WinBoard rejects variant multi"? It does not allow you to specify it with the -variant option from the command line? Note that you posted a wrong syntax of the variant feature: quotes should only surround the entire list, not individual variant names:

feature variants="normal,multi"

If the engine really prints it as you posted it here, WinBoard would stop parsing the feature after the first closing quote, and ignore the rest, which could explain the trouble you are having.
Thanks, that was exactly the reason!! After fixing this quoting issue and adding "/variant multi" to the WB command line I played my first Marseillais Chess game against my engine! Unfortunately it crashed in the endgame (I was already lost with a piece and many pawns down ...), and in the late middlegame it also made an illegal move, but it was fun. I try to fix the issues, then I could perhaps release the engine in a few days or so (although I guess it is very weak: I played a blitz game and it calculated not more than 4 "double plies" deep).

Of course the "modern" way that WinBoard offers apart from "variant multi" is the better way. The "multi" solution is only an intermediate state for me that helped to quickly start testing. At some point I will implement all the necessary "highlight" stuff etc. but for now I would like to focus on making my engine play correctly.

Sven
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Marseillais Chess

Post by Sven »

So here is the first version of Femto, the new World Champion of Marseillais Computer Chess :mrgreen: :mrgreen: :mrgreen:

As usual it is a WinBoard engine and supports normal and "Marseillais" chess. For the latter the "Alien Edition" of WinBoard is required and must be started with the "/variant multi" command line switch. Two-leg moves are entered by keeping Ctrl pressed while entering the first leg.

No hash table, no null move pruning, no killer move, eval = material + PST. The Marseillais implementation also has no qsearch yet.

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

Re: Marseillais Chess

Post by hgm »

Wow, you are quick! I have not even started yet. (But I made great progress in on-the-fly EGT generations! 8-) )
Sven
Posts: 4052
Joined: Thu May 15, 2008 9:57 pm
Location: Berlin, Germany
Full name: Sven Schüle

Re: Marseillais Chess

Post by Sven »

hgm wrote:Wow, you are quick! I have not even started yet. (But I made great progress in on-the-fly EGT generations! 8-) )
I started working on "Femto" on 31-dec-2013, initially for standard chess only. I added the Marseillais stuff during the last 10 days. There were a lot of modifications, and I'm not done yet with all necessary changes, a lot is still missing, for instance repetition detection.

Since you only need one afternoon for your Marseillais-Max changes ;-) I am still hoping that we can play our WMCCC match until end of this week :lol:
User avatar
hgm
Posts: 27837
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Marseillais Chess

Post by hgm »

I will see what I can do. Actually XBoard themes and GNU Shogi were also still on my to-do, list. But I should be able to spare one afternoon. :D
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Marseillais Chess

Post by Evert »

It actually occurred to me this morning that there is another way to make an "othochess" engine play Marseillaise that may be less invasive in some ways: compulsory null-move.

A general sequence would look like this:

1. White plays his first leg. Flip side to move.
2. Black to move, but white still has to finish his second leg. Compulsory null-move. Flip side to move.
3. White to move. If black is in check, white has a compulsory null-move. Otherwise play normally. Flip side to move.
4. Black to move. If black is in check, play a check evasion (as normal). Flip side to move.
5. White to move, but black still has to finish his second leg. Compulsory null-move, flip side to move.
6. Black to move. If white is in check, black has a compulsory null-move. Otherwise play normally. Flip side to move.
7. Goto 1.

In fact, steps 1-3 are identical to 4-6, as they should be. In terms of tweaking the alpha-beta search, this probably touches fewer code, at the cost of polluting the game history with a load of null-moves. It also complicates the communication with XBoard and the sending of PV moves a little, but nothing that cannot be handled with some care.

Unless I come up with a significant drawback, I'll probably go with something like this for Sjaak.

Other random thoughts:
For move ordering, on the first leg there are no "losing" captures, so that should be ignored. On the second leg, withdrawing threatened pieces is probably a good idea (can be done with some more null-move trickery in the search), as are up-captures, especially if they were enabled by the first leg.
During evaluation, any threatened piece should be heavily penalised, since it can be captured for free.
Norbert Raimund Leisner
Posts: 1643
Joined: Tue May 20, 2008 4:57 pm
Location: Augsburg - Germany

Re: Marseillais Chess

Post by Norbert Raimund Leisner »

The Femto Engine for Standard Chess http://www.schuelebln.de/chess/femto/fe ... 17-x86.zip
runs under WB-2 protocol with ChessGUI and WinBoard Interface, but executes no moves under current Arena version:


2016-09-02 09:21:30,535**----------Neue Partie---2016-09-02 09:21:30,535 Fr -------------
2016-09-02 09:21:30,676**----------Neue Partie---2016-09-02 09:21:30,676 Fr -------------
2016-09-02 09:21:30,723**screen: 1280x1024
2016-09-02 09:21:30,723**Monitors: 1
2016-09-02 09:21:30,723**Monitor0: 1280x1024
2016-09-02 09:21:30,723**FormMonitor: 0
2016-09-02 09:21:30,723**DesktopRect: 0/0 .. 1280/1024
2016-09-02 09:21:52,019*1*----------------------------Starte Motor 1 Femto----------------------------
2016-09-02 09:21:52,019*1*Configured Engine 1 Type: WB2
2016-09-02 09:21:52,034*1*Engine 1 dir: C:\Users\NRL\Downloads\femto-0.9-20140217-x86
2016-09-02 09:21:52,034*1*Engine 1 commandline: C:\Users\NRL\Downloads\femto-0.9-20140217-x86\femto.exe
2016-09-02 09:21:52,143*1*Engine 1 ProcessID: 2180
2016-09-02 09:21:52,143*1*Engine 1 Prio:32 ThreadPrio:0
2016-09-02 09:21:52,143<--1:feature done=0
2016-09-02 09:21:52,143-->1:accepted done
2016-09-02 09:21:52,143-->1:xboard
2016-09-02 09:21:52,143-->1:protover 2
2016-09-02 09:21:52,190<--1:# Your move: # Your move:
2016-09-02 09:21:52,190<--1:feature ping=1
2016-09-02 09:21:52,190-->1:accepted ping
2016-09-02 09:21:52,237<--1:feature setboard=0
2016-09-02 09:21:52,237-->1:accepted setboard
2016-09-02 09:21:52,237<--1:feature playother=0
2016-09-02 09:21:52,237-->1:accepted playother
2016-09-02 09:21:52,237<--1:feature time=0
2016-09-02 09:21:52,237-->1:accepted time
2016-09-02 09:21:52,237<--1:feature sigint=0
2016-09-02 09:21:52,237-->1:accepted sigint
2016-09-02 09:21:52,237<--1:feature sigterm=0
2016-09-02 09:21:52,237-->1:accepted sigterm
2016-09-02 09:21:52,268<--1:feature analyze=0
2016-09-02 09:21:52,268-->1:accepted analyze
2016-09-02 09:21:52,299<--1:feature myname="femto-0.9-20140217"
2016-09-02 09:21:52,331<--1:feature variants="normal,marseillais,multi"
2016-09-02 09:21:52,331-->1:accepted variants
2016-09-02 09:21:52,362<--1:feature colors=0
2016-09-02 09:21:52,362-->1:accepted colors
2016-09-02 09:21:52,362<--1:feature name=0
2016-09-02 09:21:52,362-->1:accepted name
2016-09-02 09:21:52,362<--1:feature nps=0
2016-09-02 09:21:52,362-->1:accepted nps
2016-09-02 09:21:52,393<--1:feature debug=1
2016-09-02 09:21:52,393-->1:accepted debug
2016-09-02 09:21:52,424<--1:feature done=1
2016-09-02 09:21:52,424-->1:accepted done
2016-09-02 09:21:52,502-->1:new
2016-09-02 09:21:52,502-->1:random
2016-09-02 09:21:52,502-->1:level 0 5 0
2016-09-02 09:21:52,502-->1:post
2016-09-02 09:21:52,502-->1:hard
2016-09-02 09:21:52,502-->1:easy
2016-09-02 09:21:52,502-->1:ping 3
2016-09-02 09:21:52,518<--1:# rnbqkbnr
2016-09-02 09:21:52,533<--1:# pppppppp
2016-09-02 09:21:52,549<--1:# ........
2016-09-02 09:21:52,565<--1:# ........
2016-09-02 09:21:52,580<--1:# ........
2016-09-02 09:21:52,596<--1:# ........
2016-09-02 09:21:52,611<--1:# PPPPPPPP
2016-09-02 09:21:52,627<--1:# RNBQKBNR
2016-09-02 09:21:52,643<--1:Error (illegal move): (null)
2016-09-02 09:21:52,658<--1:Error (illegal move): (null)
2016-09-02 09:21:52,674<--1:Error (illegal move): (null)
2016-09-02 09:21:52,689<--1:Error (illegal move): (null)
2016-09-02 09:21:52,705<--1:pong 3
2016-09-02 09:22:08,996-->1:?
2016-09-02 09:22:08,996-->1:force
2016-09-02 09:22:08,996-->1:quit
2016-09-02 09:22:09,495*1*--------------------------Starte Motor 1 Surprise---------------------------
2016-09-02 09:22:09,495*1*Configured Engine 1 Type: WB2
2016-09-02 09:22:09,495*1*Engine 1 dir: C:\Users\NRL\Downloads\surprise-4.3-beta13-JA\surprise-4.3-beta13-JA\surprise
2016-09-02 09:22:09,495*1*Engine 1 commandline: C:\Users\NRL\Downloads\surprise-4.3-beta13-JA\surprise-4.3-beta13-JA\surprise\surprise.exe
2016-09-02 09:22:09,604*1*Engine 1 ProcessID: 3748
2016-09-02 09:22:09,604*1*Engine 1 Prio:32 ThreadPrio:0
2016-09-02 09:22:09,604<--1:feature done=0
2016-09-02 09:22:09,604-->1:accepted done
2016-09-02 09:22:09,604<--1:Perft check 1 (item 1, d= 1): ok (00:00.00, nps= 0)
2016-09-02 09:22:09,604<--1:Perft check 2 (item 2, d= 2): ok (00:00.00, nps= 0)
2016-09-02 09:22:09,604<--1:Perft check 3 (item 3, d= 3): ok (00:00.00, nps= 0)
2016-09-02 09:22:09,604-->1:xboard
2016-09-02 09:22:09,604-->1:protover 2
2016-09-02 09:22:09,651<--1:Perft check 4 (item 4, d= 4): ok (00:00.02, nps= 9864000)
2016-09-02 09:22:09,698<--1:Perft check 5 (item 11, d= 1): ok (00:00.00, nps= 0)
2016-09-02 09:22:09,698<--1:Perft check 6 (item 12, d= 2): ok (00:00.00, nps= 0)
2016-09-02 09:22:09,698<--1:Perft check 7 (item 13, d= 3): ok (00:00.02, nps= 4893100)
2016-09-02 09:22:09,698<--1:Perft check 8 (item 17, d= 1): ok (00:00.00, nps= 0)
2016-09-02 09:22:09,698<--1:Perft check 9 (item 18, d= 2): ok (00:00.00, nps= 0)
2016-09-02 09:22:09,729<--1:info: opening book "surprise_openings.txt" contains 329 variations and 3017 positions
2016-09-02 09:22:09,760<--1: R- N- B- Q- K- B- N- R-
2016-09-02 09:22:09,791<--1: P- P- P- P- P- P- P- P-
2016-09-02 09:22:09,791<--1: . . . . . . . .
2016-09-02 09:22:09,823<--1: . . . . . . . .
2016-09-02 09:22:09,854<--1: . . . . . . . .
2016-09-02 09:22:09,885<--1: . . . . . . . .
2016-09-02 09:22:09,885<--1: P+ P+ P+ P+ P+ P+ P+ P+
2016-09-02 09:22:09,885<--1: R+ N+ B+ Q+ K+ B+ N+ R+
2016-09-02 09:22:09,916<--1:Your move:
2016-09-02 09:22:09,947<--1: R- N- B- Q- K- B- N- R-
2016-09-02 09:22:09,947<--1: P- P- P- P- P- P- P- P-
2016-09-02 09:22:09,979<--1: . . . . . . . .
2016-09-02 09:22:10,010<--1: . . . . . . . .
2016-09-02 09:22:10,010<--1: . . . . . . . .
2016-09-02 09:22:10,041<--1: . . . . . . . .
2016-09-02 09:22:10,072<--1: P+ P+ P+ P+ P+ P+ P+ P+
2016-09-02 09:22:10,072<--1: R+ N+ B+ Q+ K+ B+ N+ R+
2016-09-02 09:22:10,103<--1:Your move:
2016-09-02 09:22:10,103<--1:feature analyze=0 colors=1 draw=0 myname="Surprise 4.3-beta13-JA" name=0 ping=1 setboard=1
2016-09-02 09:22:10,103-->1:accepted analyze
2016-09-02 09:22:10,103-->1:accepted colors
2016-09-02 09:22:10,103-->1:accepted draw
2016-09-02 09:22:10,103-->1:accepted name
2016-09-02 09:22:10,103-->1:accepted ping
2016-09-02 09:22:10,103-->1:accepted setboard
2016-09-02 09:22:10,135<--1:sigint=0 time=0 variants="normal"
2016-09-02 09:22:10,135<--1:feature done=1
2016-09-02 09:22:10,135-->1:accepted done
2016-09-02 09:22:10,197-->1:new
2016-09-02 09:22:10,197-->1:random
2016-09-02 09:22:10,197-->1:level 0 5 0
2016-09-02 09:22:10,197-->1:post
2016-09-02 09:22:10,197-->1:hard
2016-09-02 09:22:10,197-->1:easy
2016-09-02 09:22:10,197-->1:ping 1
2016-09-02 09:22:10,213<--1:pong 1
2016-09-02 09:23:21,397-->1:level 0 5 0
2016-09-02 09:23:21,428****Tour**======== Turnier 1 ========
2016-09-02 09:23:21,615****Tour**
2016-09-02 09:23:21,615****Tour**Paarung 1/1: Femto - Surprise
2016-09-02 09:23:21,631-->1:?
2016-09-02 09:23:21,631-->1:force
2016-09-02 09:23:21,631-->1:quit