WinBoard, exotic version

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: WinBoard, exotic version

Post by Daniel Shawul »

Hello HG. Sorry for the delay. I am in a situation where I can't do anything with chess right now (may involve moving with my boss or hopefully not). So I will be implementing it in the weekend.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: WinBoard, exotic version

Post by Daniel Shawul »

Hello Rein
I have fixed it now and is uploaded. It was still a problem with declaration of variables . I am sure v1.0 had all of this working correctly since I had matching perft numbers. Anyway thanks for the report. I appreciate it.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: WinBoard, exotic version

Post by Daniel Shawul »

Is this exe really an alien variant? It seems that it only accepts orthodox chess. I replaced the winboard 4.5-TM exe I had with this one. It does not change the board after I clicked on new game.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: WinBoard, exotic version

Post by Daniel Shawul »

feature highlight=1

to indicate the engine wants to receive the

lift SQUARE
put SQUARE
Yes that is fine. And infact I will have no problem with it being the default in alien mode. Without this the engine can't be usable against a human opponent so it is not really that much of an otpion.
commands, on every (left) up-click and down-click the user makes on the board. (Actually I think we have also to prepare for off-board up-clicks, as a down-click grabs all mouse events exclusively, and you could up-click on the clock or ambiguously on the grid lines anyway. How about a put without any SQUARE indication in that case? Or would it be better to send put @@?) How about down-clicks in the holdings, btw? Should the engine also get those? Normally I don't highight any squares when the user picks up a piece for dropping. So perhaps it should simply count as any off-board down-click, i.e. not be sent to the engine.
I think holdings are better left off. For one if a user clicks a piece in holding , it is implicit that he can drop it anywhere empty, so there is not much of a point in highlighting or legality testing. Only problem I see is if the user tries to drop a piece not in his holding (opponent's holdings). May be there are some crazy games I don't know of which allow that but it is pretty far fetched.. So I think winboard can have a rule for drop moves even in alien mode, that allows a player to pick a piece in his holding and drop it in an empty square...

I think winboard should also not report when user clicks outside board, either it ignores the clicks or undoes the whole move making process the beginning ?
For the 'FEN' accompanying the highlight command (or would it be better to rename this a mark command, to not confuse it with the highlighting with arrow?), I want to propose the following letters:

R red
Y yellow
G green
C cyan
B blue
M magenta

In the initial implemantation, only the first two will work, btw, and produce the -premoveHighlightColor and -highlightColor, respectively.
Sounds good. We might not need more than 3 colors anyways
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: WinBoard, exotic version

Post by Daniel Shawul »

lift SQUARE is sent when the user selects a piece. The engine is not necessarily informed when the user deselects the piece (by clicking it a second time, or by dragging the selected piece off board). So it must be prepared to get a second lift command after it, which informs it that the user cancelled the original selection, and selected a new piece in stead.

put SQUARE is sent when the user had selected a piece (namely the one on the square mentioned in the last lift), and moved it to another square (mentioned in the put), i.e. when he completes a leg. (No distinction is made between drag-drop and click-click.) If the move is not yet complete (i.e. the user held the Ctrl key down), the put will be immediately followed by a lift on the same square. (Because WinBoard now always leaves the moved piece selected.) The user can then change the selection, if he wants, which will be reported by new lift commands.

The engine should only respond to lift commands with highlight instructions. In principle, after a put, the move is done, and when it sends a highlight in response to it, the markers might not be cleared by any subsequent event. Any markers put in response to a lift will be cleared by the GUI before the move entry is completed. (E.g. because the user releases the piece, clicks a to-square for it, selects a new piece.)
I think I get it more or less. Just to be sure here is what I am implementing. When I get a lift, I send a FEN of colors 4RG2/... etc for winboard to highlight from the root position. And I have to track each leg of the move and makes the "partial" move on the root board, and I make these move when I get a put which signals end of leg move. Only problem I see is if the user makes an illegal leg move like jumping multiple squares in checkers when it is not allowed. I guess in that case I send "Illegal move" but I am not sure ? And when the move is non-ambigious I send the only available move to winboard to make it immediately on behalf of the human. Can I refuse to send a highlight FEN if I don't want to, for instance if I want to handle highlighting once for a multi-leg move when the user makes the first lift, I show him all available paths once.
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: WinBoard, exotic version

Post by hgm »

Daniel Shawul wrote:Is this exe really an alien variant? It seems that it only accepts orthodox chess. I replaced the winboard 4.5-TM exe I had with this one. It does not change the board after I clicked on new game.
Are you sure legality checking was switched off? It should say "alien-20110622" in the Help->About,and forme it does set up the board when I run NebiyuCheckers in -variant checkers.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: WinBoard, exotic version

Post by Daniel Shawul »

Ok I didn't test the checkers variant before. That one seems to work . But the alien variant has problems. variant=alien that is. Shogi is the first game nebiyu should have displayed. Anyway now I can continue with the test with variant checkers.
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: WinBoard, exotic version

Post by hgm »

Daniel Shawul wrote:Yes that is fine. And infact I will have no problem with it being the default in alien mode. Without this the engine can't be usable against a human opponent so it is not really that much of an otpion.
No, that is not true. An engine should work perfectly in alien mode even when it does not support this feature. The only thing it cannot do in that case is display highlight markers on the board. It will still get sent the full move entered by the user when the user is done entering the last leg, and only start thinking when that happens (or reply with "Illegal move").

It should not react with "Illegal move" to any "lift" or "put" commands; WinBoard will not understand that, as according to it, no move has been sent yet.

If we want to use this for legality checking, I should extend the protocol such that the COLORFEN also contains info on legal to-squaresof the currentleg. Currently this is not necessary; the engine could, in Checkers, for instance put markers on allpieces you can capture, none of them on legal to-squares, or mark the final to-square,not necessarily part of the next leg.

In that case I would use capitalization to indicate that a marked square is a legalto-square of the current leg, so that you could still use lower-case to ut markers on squares that are not. And use capital T (transparent) to indicate a square that should not be marked with any color, but is a legal to-square. WinBoard could then be programmed to refuse all legs where the user does not indicate a to-square that was highlighted as valid. (I.e. after a drag-drop to a non-marked square the piece would jump back to the from square of the leg, and stay selected there, while on a click-click move the to-click would simply be ignored.)
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: WinBoard, exotic version

Post by Daniel Shawul »

No, that is not true. An engine should work perfectly in alien mode even when it does not support this feature. The only thing it cannot do in that case is display highlight markers on the board. It will still get sent the full move entered by the user when the user is done entering the last leg, and only start thinking when that happens (or reply with "Illegal move").
You are right. The problem I had with with multi-player games is confusing me.

It should not react with "Illegal move" to any "lift" or "put" commands; WinBoard will not understand that, as according to it, no move has been sent yet.
Ok. The reason I asked about it was because to handle partial moves (legs) of a move, I have to first make that move on the root board which should be legal. If the leg move involves a capture , the piece is removed f.i
If we want to use this for legality checking, I should extend the protocol such that the COLORFEN also contains info on legal to-squaresof the current leg. Currently this is not necessary; the engine could, in Checkers, for instance put markers on allpieces you can capture, none of them on legal to-squares, or mark the final to-square,not necessarily part of the next leg.
You mean reserve one color to indicate legal destination square ? That should work. It might even be better to refuse the partial move when the first leg move made by user is illegal i.e Engine sends "Illegal leg move" on recieving a put command. Making an illegal move and generating highlight FEN could be difficult for the engine.
In that case I would use capitalization to indicate that a marked square is a legalto-square of the current leg, so that you could still use lower-case to ut markers on squares that are not. And use capital T (transparent) to indicate a square that should not be marked with any color, but is a legal to-square. WinBoard could then be programmed to refuse all legs where the user does not indicate a to-square that was highlighted as valid. (I.e. after a drag-drop to a non-marked square the piece would jump back to the from square of the leg, and stay selected there, while on a click-click move the to-click would simply be ignored.)
I haven't yet understood the click command but it seems the move legality and fast move making is handled there ,right ?
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Success!

Post by Daniel Shawul »

Yep, on the first try. All I did was to look at the move list of any of the variants and mark captures as red, non-captures as yellow. Pretty easy implementation. It marks destination squares with yellow and red that is it, and it works very well. I don't even think the highlighting for intermediate leg-moves is necessary but I will test it anyway. You do have a way of offloading work to the engine though ;) Ask the engine more questions now (the right ones) so that I would extract info and send back.
For instance, I can send illegal leg move for on a put, which does nothing right now. Or signal winboard that there is only one legal move etc..

Btw this is done with pondering on. Nebiyu can actually process any command while pondering, I don't know why I thought it couldn't last time. Anyway log file is shown below.
setup (P...Q.p...q.) 8x8+0 1p1p1p1p/p1p1p1p1/1p1p1p1p/8/8/P1P1P1P1/1P1P1P1P/P1P1P1P1 w - - 0 1
<000000000547> level 40 5 0
<000000000547> post
<000000000547> hard
<000000009563> easy

<000000033235> lift c3
highlight 8/8/8/8/1Y1Y4/8/8/8
<000000036532> lift c3
highlight 8/8/8/8/1Y1Y4/8/8/8
<000000040422> put d4

<000000040422> name dabdi001
Hello dabdi001!
<000000040422> time 30000
<000000040422> otim 30000
<000000040422> usermove c3d4
1p1p1p1p/p1p1p1p1/1p1p1p1p/8/3P4/P3P1P1/1P1P1P1P/P1P1P1P1 b - - 0 1
[st = 7088ms, mt = 149250ms , moves_left 40]
2 35 0 45 b6c5 d4b6 a7c5 EBF = 6.15
3 35 0 114 b6c5 d4b6 a7c5 EBF = 4.46
4 20 0 235 b6c5 d4b6 a7c5 e3d4 c5e3 f2d4 EBF = 3.61
5 20 0 304 b6c5 d4b6 a7c5 e3d4 c5e3 f2d4 EBF = 2.88
5 20 0 450 b6c5 d4b6 a7c5 e3d4 c5e3 f2d4 EBF = 3.14
6 20 0 517 b6c5 d4b6 a7c5 e3d4 c5e3 f2d4 EBF = 2.61
6 20 0 803 b6c5 d4b6 a7c5 e3d4 c5e3 f2d4 EBF = 2.84
7 10 0 1746 b6c5 d4b6 a7c5 b2c3 c7b6 e3d4 c5e3 f2d4 EBF = 2.72
7 10 0 2142 b6c5 d4b6 a7c5 b2c3 c7b6 e3d4 c5e3 f2d4 EBF = 2.81
8 10 0 2366 b6c5 d4b6 a7c5 b2c3 c7b6 e3d4 c5e3 f2d4 EBF = 2.48
8 10 0 3694 b6c5 d4b6 a7c5 b2c3 c7b6 e3d4 c5e3 f2d4 EBF = 2.63
9 10 0 5586 b6c5 d4b6 a7c5 g3f4 f6g5 e3d4 c5e3 f2d4 g5e3 d2f4 EBF = 2.46
9 10 0 6581 b6c5 d4b6 a7c5 g3f4 f6g5 e3d4 c5e3 f2d4 g5e3 d2f4 EBF = 2.51
10 20 0 7802 b6c5 d4b6 a7c5 g3f4 c7b6 e3d4 c5e3 f2d4 f6e5 d4f6 e7g5e3 d2f4 EBF = 2.32
10 20 1 9163 b6c5 d4b6 a7c5 g3f4 c7b6 e3d4 c5e3 f2d4 f6e5 d4f6 e7g5e3 d2f4 EBF = 2.36
11 10 1 14548 b6c5 d4b6 a7c5 b2c3 f6g5 g3f4 g7f6 e3d4 c5e3 f2d4 g5e3 d2f4 EBF = 2.27
11 10 1 17184 b6c5 d4b6 a7c5 b2c3 f6g5 g3f4 g7f6 e3d4 c5e3 f2d4 g5e3 d2f4 EBF = 2.30
'
'
nodes = 16438137 <28 qnodes> time = 6203ms nps = 2650030
splits = 0 badsplits = 0
<000000046625> move f6e5

<000000051063> lift d4
highlight 8/8/5R2/8/8/8/8/8
<000000054750> put f6

<000000054750> time 29379
<000000054750> otim 29187
<000000054750> usermove d4f6
1p1p1p1p/p1p1p1p1/1p1p1P1p/8/8/P3P1P1/1P1P1P1P/P1P1P1P1 b - - 0 2
[st = 7119ms, mt = 146145ms , moves_left 39]
2 -20 0 44 e7g5 a3b4 EBF = 6.08
3 0 0 97 e7g5 a3b4 g5f4 g3e5 d6f4 e3g5 h6f4 EBF = 4.20
4 0 0 198 e7g5 a3b4 g5f4 g3e5 d6f4 e3g5 h6f4 EBF = 3.44
5 0 0 371 e7g5 a3b4 g5f4 g3e5 d6f4 e3g5 h6f4 EBF = 3.01
5 0 0 375 e7g5 a3b4 g5f4 g3e5 d6f4 e3g5 h6f4 EBF = 3.02
6 0 1 837 e7g5 g3f4 d8e7 e3d4 g5e3 d2f4 EBF = 2.86
6 0 1 841 e7g5 g3f4 d8e7 e3d4 g5e3 d2f4 EBF = 2.86
7 0 1 1247 e7g5 g3f4 d8e7 h2g3 d6e5 f4d6 c7e5 EBF = 2.58
7 0 1 1251 e7g5 g3f4 d8e7 h2g3 d6e5 f4d6 c7e5 EBF = 2.58
8 -10 1 2147 e7g5 g3f4 d8e7 h2g3 g7f6 e3d4 g5e3 d2f4 EBF = 2.44
8 0 1 2788 g7e5 g3f4 e5g3 h2f4 h8g7 b2c3 d6e5 f4d6 c7e5 EBF = 2.53
8 0 1 2788 g7e5 g3f4 e5g3 h2f4 h8g7 b2c3 d6e5 f4d6 c7e5 EBF = 2.53
9 0 1 3843 g7e5 g3f4 e5g3 h2f4 h8g7 b2c3 d6e5 f4d6 c7e5 EBF = 2.35
9 0 1 4055 g7e5 g3f4 e5g3 h2f4 h8g7 b2c3 d6e5 f4d6 c7e5 EBF = 2.37
10 -10 1 5490 g7e5 g3f4 e5g3 h2f4 h8g7 b2c3 b6c5 a1b2 d6e5 f4d6 c7e5 EBF = 2.23
10 0 1 8981 e7g5 g3f4 d8e7 b2c3 g7f6 h2g3 h8g7 a1b2 d6e5 f4d6 c7e5 EBF = 2.35
10 0 1 8981 e7g5 g3f4 d8e7 b2c3 g7f6 h2g3 h8g7 a1b2 d6e5 f4d6 c7e5 EBF = 2.35
11 0 1 12224 e7g5 g3f4 d8e7 b2c3 g7f6 h2g3 h8g7 a1b2 d6e5 f4d6 c7e5 EBF = 2.23
11 0 1 12336 e7g5 g3f4 d8e7 b2c3 g7f6 h2g3 h8g7 a1b2 d6e5 f4d6 c7e5 EBF = 2.23
'
'
26 0 345 9113020 g7e5 g3f4 e5g3 h2f4 b6c5 b2c3 h8g7 a1b2 a7b6 e3d4 c5e3 f2d4 b8a7 d2e3 b6c5 d4b6 a7c5 g1h2 c7b6 c1d2 g7f6 h2g3 f6e5 c3b4 d8c7 b2c3 EBF = 1.80
nodes = 19130344 <25 qnodes> time = 7141ms nps = 2678944
splits = 0 badsplits = 0
<000000061891> move g7e5

<000000065672> lift e3
highlight 8/8/8/8/3Y1Y2/8/8/8
<000000069875> lift e3
highlight 8/8/8/8/3Y1Y2/8/8/8
<000000073313> lift e3
highlight 8/8/8/8/3Y1Y2/8/8/8

<000000083797> result * {xboard exit}

[FEN "1p1p1p1p/p1p1p1p1/1p1p1p1p/8/8/P1P1P1P1/1P1P1P1P/P1P1P1P1 w - - 0 1"]

1.c3d4 f6e5 2.d4f6 g7e5

<000000083797> force
<000000083797> quit
Bye Bye