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 »

I just did that but WB doesn't load the engine in 'edit game' mode, does it ?
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: WinBoard, exotic version

Post by hgm »

Yes, it does. The first engine is loaded and engaged in any mode you can select through the menus. When you have selected to use an engine in the startup menu, rather than ICS or game viewer. (And not used the -ncp or -ics options.) Even with -ics you could still have an engine if you used -zp as well.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: WinBoard, exotic version

Post by Daniel Shawul »

Hmm, I have this in the log file but it doesn't seem to update the display . i will investigate move

Code: Select all

<000000005625>easy
<000000005625>force
<000000005625>setboard 8/8/8/3Pp3/3pP3/8/8/8 w - - 0 1
<000000005656>P@e6
setup 8/8/4P3/3PP3/3pP3/8/8/8 b - - 0 1
<000000006609>P@f4
setup 8/8/4P3/3PP3/3ppp2/8/8/8 w - - 0 2
<000000007609>P@c3
setup 8/8/4P3/3PP3/3Ppp2/2P5/8/8 b - - 0 2
<000000008609>P@c6
setup 8/8/2p1P3/3pP3/3Ppp2/2P5/8/8 w - - 0 3
<000000009562>P@g3
setup 8/8/2p1P3/3pP3/3PpP2/2P3P1/8/8 b - - 0 3
<000000009562>P@e7
setup 8/4p3/2p1p3/3pp3/3PpP2/2P3P1/8/8 w - - 0 4
<000000009562>P@d6
setup 8/4p3/2pPp3/3PP3/3PpP2/2P3P1/8/8 b - - 0 4
<000000009562>P@c4
setup 8/4p3/2pPp3/3pP3/2pppP2/2P3P1/8/8 w - - 0 5
<000000009562>P@b4
setup 8/4p3/2pPp3/3pP3/1PPPPP2/2P3P1/8/8 b - - 0 5
<000000009562>P@e3
setup 8/4p3/2pPp3/3pp3/1PPPpP2/2P1p1P1/8/8 w - - 0 6
<000000009562>P@f2
setup 8/4p3/2pPp3/3pp3/1PPPpP2/2P1P1P1/5P2/8 b - - 0 6
<000000009562>P@h2
setup 8/4p3/2pPp3/3pp3/1PPPpp2/2P1P1p1/5P1p/8 w - - 0 7
<000000009562>P@g4
setup 8/4p3/2pPp3/3pp3/1PPPPPP1/2P1P1p1/5P1p/8 b - - 0 7
<000000009562>P@g5
setup 8/4p3/2pPp3/3pp1p1/1PPPPPp1/2P1P1p1/5P1p/8 w - - 0 8
<000000009562>P@h4
setup 8/4p3/2pPp3/3pp1p1/1PPPPPPP/2P1P1P1/5P1p/8 b - - 0 8
<000000009562>P@g2
setup 8/4p3/2pPp3/3pp1p1/1PPPPPpP/2P1P1p1/5Ppp/8 w - - 0 9
<000000009562>P@f6
setup 8/4p3/2pPPP2/3pP1P1/1PPPPPpP/2P1P1p1/5Ppp/8 b - - 0 9
<000000009562>P@a4
setup 8/4p3/2pPPP2/3pP1P1/pppppppP/2P1P1p1/5Ppp/8 w - - 0 10
<000000009562>P@b6
setup 8/4p3/1PPPPP2/3pP1P1/pppppppP/2P1P1p1/5Ppp/8 b - - 0 10
<000000009578>P@d2
setup 8/4p3/1PPPPP2/3pP1P1/pppppppP/2p1p1p1/3p1Ppp/8 w - - 0 11
<000000009578>P@g1
setup 8/4p3/1PPPPP2/3pP1P1/ppppppPP/2p1p1P1/3p1PPp/6P1 b - - 0 11
<000000009578>P@h6
setup 8/4p3/1PPPPP1p/3pP1p1/ppppppPP/2p1p1P1/3p1PPp/6P1 w - - 0 12
<000000009578>P@c5
setup 8/4p3/1PPPPP1p/2PPP1p1/pppPppPP/2p1P1P1/3p1PPp/6P1 b - - 0 12
<000000009578>P@c7
setup 8/2p1p3/1PppPP1p/2pPp1p1/pppPppPP/2p1P1P1/3p1PPp/6P1 w - - 0 13
<000000009578>P@c1
setup 8/2p1p3/1PppPP1p/2pPp1p1/pppPppPP/2p1P1P1/3P1PPp/2P3P1 b - - 0 13
<000000009578>P@a6
setup 8/2p1p3/ppppPP1p/2pPp1p1/pppPppPP/2p1P1P1/3P1PPp/2P3P1 w - - 0 14
<000000009578>P@g6
setup 8/2p1p3/ppppPPPp/2pPp1P1/pppPppPP/2p1P1P1/3P1PPp/2P3P1 b - - 0 14
<000000009578>P@e1
setup 8/2p1p3/ppppPPPp/2pPp1P1/pppPppPP/2p1P1P1/3p1PPp/2P1p1P1 w - - 0 15
<000000009578>P@d8
setup 3P4/2p1P3/ppppPPPp/2pPp1P1/pppPppPP/2p1P1P1/3p1PPp/2P1p1P1 b - - 0 15
<000000009578>P@f8
setup 3P1p2/2p1p3/ppppPPPp/2pPp1P1/pppPppPP/2p1P1P1/3p1PPp/2P1p1P1 w - - 0 16
<000000009578>P@a5
setup 3P1p2/2P1p3/pPppPPPp/P1pPp1P1/pppPppPP/2p1P1P1/3p1PPp/2P1p1P1 b - - 0 16
<000000009578>P@b8
setup 1p1P1p2/2p1p3/pPppPPPp/P1pPp1P1/pppPppPP/2p1P1P1/3p1PPp/2P1p1P1 w - - 0 17
<000000009578>P@d7
setup 1p1P1p2/2pPp3/pPpPPPPp/P1pPp1P1/pppPppPP/2p1P1P1/3p1PPp/2P1p1P1 b - - 0 17
<000000009578>P@f7
setup 1p1P1p2/2pPpp2/pPpPpPPp/P1ppp1P1/pppPppPP/2p1P1P1/3p1PPp/2P1p1P1 w - - 0 18
<000000009578>P@f5
setup 1p1P1p2/2pPpp2/pPpPPPPp/P1pppPP1/pppPppPP/2p1P1P1/3p1PPp/2P1p1P1 b - - 0 18
<000000009578>P@d3
setup 1p1P1p2/2pPpp2/pPpPPPPp/P1pppPP1/ppppppPP/2ppP1P1/3p1PPp/2P1p1P1 w - - 0 19
<000000009578>P@a3
setup 1p1P1p2/2pPpp2/pPpPPPPp/P1PppPP1/PPppppPP/P1ppP1P1/3p1PPp/2P1p1P1 b - - 0 19
<000000009578>P@f3
setup 1p1P1p2/2pPpp2/pPpPPPPp/P1PppPP1/PPppppPP/P1ppppP1/3p1PPp/2P1p1P1 w - - 0 20
<000000009578>P@c2
setup 1p1P1p2/2pPpp2/pPpPPPPp/P1PppPP1/PPPpPpPP/P1PPppP1/2Pp1PPp/2P1p1P1 b - - 0 20
<000000009578>P@a2
setup 1p1P1p2/2pPpp2/pPpPPPPp/p1PppPP1/pPPpPpPP/p1PPppP1/p1Pp1PPp/2P1p1P1 w - - 0 21
<000000009578>P@b5
setup 1p1P1p2/2pPpp2/pPPPPPPp/pPPppPP1/pPPpPpPP/p1PPppP1/p1Pp1PPp/2P1p1P1 b - - 0 21
<000000009578>P@h1
setup 1p1P1p2/2pPpp2/pPPPPPPp/pPPppPP1/pPPpPpPP/p1PPppP1/p1Pp1Ppp/2P1p1Pp w - - 0 22
<000000009578>P@c8
setup 1pPP1p2/2PPpp2/pPPPPPPp/pPPppPP1/pPPpPpPP/p1PPppP1/p1Pp1Ppp/2P1p1Pp b - - 0 22
<000000009578>P@e8
setup 1ppppp2/2Pppp2/pPpPPPPp/ppPppPP1/pPPpPpPP/p1PPppP1/p1Pp1Ppp/2P1p1Pp w - - 0 23
<000000009593>P@g8
setup 1pppppP1/2PppP2/pPpPPPPp/ppPppPP1/pPPpPpPP/p1PPppP1/p1Pp1Ppp/2P1p1Pp b - - 0 23
<000000009593>P@h8
setup 1ppppppp/2PppP2/pPpPPPPp/ppPppPP1/pPPpPpPP/p1PPppP1/p1Pp1Ppp/2P1p1Pp w - - 0 24
<000000009593>P@d1
setup 1ppppppp/2PppP2/pPpPPPPp/ppPppPP1/pPPpPpPP/p1PPppP1/p1PP1Ppp/2PPp1Pp b - - 0 24
<000000009593>P@f1
setup 1ppppppp/2PppP2/pPpPPPPp/ppPppPP1/pPPpPpPP/p1PPppP1/p1PP1ppp/2PPpppp w - - 0 25
<000000009593>P@b7
setup 1ppppppp/1PPppP2/pPPPPPPp/ppPPpPP1/pPPpPpPP/p1PPppP1/p1PP1ppp/2PPpppp b - - 0 25
<000000009593>P@e2
setup 1ppppppp/1PPppP2/pPPPPPPp/ppPPpPP1/pPppPpPP/p1PpppP1/p1PPpppp/2PPpppp w - - 0 26
<000000009593>P@b3
setup 1ppppppp/1PPppP2/pPPPPPPp/ppPPpPP1/pPPpPpPP/pPPpppP1/p1PPpppp/2PPpppp b - - 0 26
<000000009593>P@b1
setup 1ppppppp/1PPppP2/pPPPPPPp/ppPPpPP1/pPPpPpPP/pPPpppP1/p1pPpppp/1ppppppp w - - 0 27
<000000009593>P@b2
setup 1ppppppp/1PPppP2/pPPPPPPp/ppPPpPP1/pPPpPpPP/pPPpppP1/pPPPpppp/1ppppppp b - - 0 27
<000000009593>P@a8
setup pppppppp/1pPppP2/pPpPPPPp/ppPppPP1/pPPpppPP/pPPpppP1/pPPPpppp/1ppppppp w - - 0 28
<000000009593>P@a7
setup pppppppp/PPPppP2/pPpPPPPp/ppPppPP1/pPPpppPP/pPPpppP1/pPPPpppp/1ppppppp b - - 0 28
<000000009593>P@a1
setup pppppppp/PPPppP2/pPpPPPPp/ppPppPP1/pPPpppPP/pPppppP1/ppPPpppp/pppppppp w - - 0 29
<000000009593>@@@@
setup pppppppp/PPPppP2/pPpPPPPp/ppPppPP1/pPPpppPP/pPppppP1/ppPPpppp/pppppppp b - - 0 29
<000000009593>P@h7
setup pppppppp/PPPppP1p/pPpPPPpp/ppPpppP1/pPPpppPP/pPppppP1/ppPPpppp/pppppppp w - - 0 30
<000000009593>P@h5
setup pppppppp/PPPppP1p/pPpPPPPp/ppPpppPP/pPPpppPP/pPppppP1/ppPPpppp/pppppppp b - - 0 30
<000000009593>P@h3
setup pppppppp/PPPppP1p/pPpPPPPp/ppPpppPp/pPPppppp/pPpppppp/ppPPpppp/pppppppp w - - 0 31
<000000009593>@@@@
setup pppppppp/PPPppP1p/pPpPPPPp/ppPpppPp/pPPppppp/pPpppppp/ppPPpppp/pppppppp b - - 0 31
<000000009593>P@g7
setup pppppppp/PPPppppp/pPpPPppp/ppPppppp/pPPppppp/pPpppppp/ppPPpppp/pppppppp w - - 0 32
<000000009593>@@@@
setup pppppppp/PPPppppp/pPpPPppp/ppPppppp/pPPppppp/pPpppppp/ppPPpppp/pppppppp b - - 0 32
<000000011250>quit
Bye Bye
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: WinBoard, exotic version

Post by hgm »

This is in variant alien? The code n WB for recieving a setup command is this:

Code: Select all

    if ((!appData.testLegality || gameInfo.variant == VariantAmazons&#41;
         && !strncmp&#40;message, "setup ", 6&#41;) &#123; // &#91;HGM&#93; allow first engine to define opening position
      int dummy, s=6; char buf&#91;MSG_SIZ&#93;;
      if&#40;appData.icsActive&#41; return;
      if&#40;forwardMostMove == 0 && cps == &first && !startedFromSetupPosition&#41; startedFromSetupPosition = TRUE;
      else if&#40;gameInfo.variant != VariantAlien&#41; return;
      if&#40;sscanf&#40;message, "setup (%s", buf&#41; == 1&#41; s = 8 + strlen&#40;buf&#41;, buf&#91;s-9&#93; = NULLCHAR, SetCharTable&#40;pieceToChar, buf&#41;;
      ParseFEN&#40;boards&#91;forwardMostMove&#93;, &dummy, message+s&#41;;
      if&#40;currentMove == forwardMostMove&#41; DrawPosition&#40;TRUE, boards&#91;currentMove&#93;);
      return;
    &#125;
That should make it accept a setup in Amazons or when legality-testing is off, and not in ICS mode for the initial position, and in Alien for any later move as well.
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: WinBoard, exotic version

Post by Daniel Shawul »

Ok I have recompile only the reversi engine with this feature on. Download and try it. Maybe winboard is updating its board by itself or rejecting the setup command as you indicated somethow.

Edit: checkers has many wrong moves so i could not reproduce the display
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: WinBoard, exotic version

Post by hgm »

OK, I see what the problem is. WB first loads the entire game, and then starts sending it to the engine move by move during auto-play. So the setups are received at a time when currentMove != forwardMostMove, and then applied to the last board of the game in steadof current move.

I solved it this way now: when an engine is playing, and a setup comes in, WB switches to display the last position of the game, (I think it did that anyway) and applies the board there. In other modes it would apply it to the current position, and in EditGame mode, when current < forwardMost, it would not apply it at all. (Assuming that you are just stepping through an existing game, for which the setups have already been done during loading or playing.)

This seems to work. New version uploaded. (Probably not when you interrupt autoplay, though. I will fix that some other time, got to go now.)
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: WinBoard, exotic version

Post by hgm »

The designed protocol needs serious rethinking, as there are terrible race conditions. When an engine in force mode receives a series of moves, it will send back a series of setup commands for the side effects of these moves, but WinBoard will in general not receive the setup in response to a move before it will send the next move. So it cannot assume that received setups apply to the 'current move' (= the last move sent).

So it becomes important to take the stm and move-number fields in the FEN seriously, in variant alien. I will change the WB behavior as follows:

When WB receives a setup command while it is not in the BeginningOfGame state (i.e. after moves have been sent to the engine),it will use the stm and move number to determine the board number (= 2*moveNr - 2 + (stm == BLACK)), and use the FEN to update that board (if it is within the range of stored boards).
Daniel Shawul
Posts: 4185
Joined: Tue Mar 14, 2006 11:34 am
Location: Ethiopia

Re: WinBoard, exotic version

Post by Daniel Shawul »

Indeed. I did not expect to progress this far as to support any board game when this discussion started. The design might need re-thinking in some places like the setup command as you said. You also mentioned about the restriction to 10x12 board and move format, I fully agree it is better to leave it as it is rather than introduce bugs trying to fix it. Also taking time and effort into consideration , some things are better left as they are, or maybe work on them slowly step by step.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: WinBoard, exotic version

Post by Evert »

So, on the topic of making WinBoard/XBoard play other interesting games.
I made a small list of historic/national chess variants that I'd like Sjaak to be able to play. At the moment it plays Makruk (albeit without the nescessary modifications to the 50-move rule) and Shatranj (although the king baring rule is a bit of a hack).
I'm looking into making it play Burmese chess, which is of course not supported. There seems to be some ambiguity about the rules, but roughly it comes down to this:
Both players start with only the pawns on the board, for white going from a3-d3 and e4-h4, for black from a5-d5 and e6-h6. All other pieces are in holdings. For the first eight moves, the players drop their pieces on the board, behind their own pawns. After that, play begins. Pawns may promote when they reach (descriptions differ) or leave the long diagonal on the other side of the board. They don't have to promote, but when they do, they promote to Ferz. This is only possible if the player's original Ferz has been taken.

I guess most of what's needed for this is already available in some form or another. The main difficulty I foresee has to do with promotions: I can decide at the beginning of my turn that a pawn gets promoted to Ferz, and then move it.

Any suggestions for the best way to go about this?
User avatar
hgm
Posts: 27795
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: WinBoard, exotic version

Post by hgm »

As it is not supported, it wouldobvosly have to be played as something else, in this case with legality testing off, because there is no supported variant with the required promotion rules. The most suitable variant to use for this would be Seirawan Chess, because that uses holdings in which captured pieces are not placed.

With legality testing off, any promotion suffix is taken seriously (even on moves with non-Pawns), and WinBoard simply substitutes the moved piece for the one indicated by the suffix. The user would have to type promotion moves, as there will be no automatic promotion or promotion popupon moves that WinBoard does not think are promotions when you enter them with the mouse.

So what you would have to do is to define a pieceToCharTable that defines the participating pieces, and the letters to indicate them. You can have the engine do that, in the setup command it sends in response to receiving variant seirawan. This then also should specify a FEN, including holdings. Like

setup (PNBR.QKpnbr.qk) 8/8/4pppp/pppp4/4PPPP/PPPP4/8/8 [KQRRBBNNkqrrbbnn] w - - 0 1

(The depicted pieceToCharTable would cause normal piece assignment except that Q would be depicted as Ferz. Of course you could select other WB pieces to participate, or use other letters for them, as long as you adapt the FEN accordingly.)

If you would also want to support normal Seirawan Chess, you could make that selectable by an engine-defined option

feature option="Play as variant seirawan: -combo S-Chess /// Burmese"

so that the user can still switch between those from the WB menus.