Promotion popup

Discussions about the WinBoard protocol. Here you can also report bugs and request new features.

Moderators: hgm, Andres Valverde

Promotion popup

Postby H.G.Muller » 17 Aug 2008, 10:43

The promotion popup menu is still a loose end in WinBoard 4.3. Originally it was suitable only for normal Chess, offering Q,R,B and N as promotion choice. Apparently it had been adapted once to also allow promotion to King when legality testing was off, for the benifit of the give-away variants. In WinBoard 4.3 I added Archbishop and Chancellor buttons to the menu, optionally appearing, when these pieces were defined in the variant, to allow the Capablanca variants to be played. In the alpha verson that adds Super Chess, I now abuse the King promotion button for Centaur.

The current situation is very unsatisfactory. Variants using other pieces than those mentioned above, will not see them in the promotion menu. The existing promotion menu is not only language dependent, but even within one language, the same fairy piece usually has a different name in one variant than in another. The promotion menu resides in the front-end, meaning that any change here has to be done in duplicate, and xboard still has the PNRQ-only.

For these reasons I would like to get rid of the promotion pop-up althogether. When I was implementing -variant super, I got an idea for this: one of the rules of Super Chess is that all captured pieces have to be positioned visibly next to the board, as only promotion to a captured piece is allowed there, and the players have to be able to see their options. I use the Crazyhouse holdings for this purpose. But if the pieces are already displayed, it would be very easy to wait for a mouse click on any of these available pieces for the choice of promotion piece, in sted of popping up the menu.

Now not all variants have holdings, and most allow promotion to not-yet-captured pieces anyway. But it would be very easy to, in stead of popping up the promotion menu, temporarily put all the pieces one could promote to on the board, for people to click, and once they have clicked, restore the board position and perform the promotion. The pieces could be displayed in a rectangular area somewhere in the center of the board, like 4x1 (WxH) in normal Chess, 3x2 in Capblanca, etc. To make it more obvious what the pieces one can select from are, they could be displayed with a different square color (e.g. black), so that it is not even obvious for the user that he is not looking at real popup, but that the pieces are really on the board. If adding new square colors is difficult.

One step in the implementation of this would be moving a SquareColor(row,column) routine to the back-end. This routine can take of the details of the bord layout (so they no longer have to be in the front-ends), such as the Xiangqi palaces, Crazyhouse holdings, and also promotion popup. It could return 5 different colors, say, for light and dark board squares, the holdings, the separation band between holdings and the promotion popup. (We could use the same color for the latter two, but it might be a useful distinction to indicate display with piece, or display with digit.)

This way the promotion choice could be virtually unlimited, the presentation of the options to the user could be entirely arranged in the back-end, using the normal board display routine, and would be completely language and piece-name independent. The only thing the front-end would have to know about it is in the mouse event handler. This should exit after calling the backend routine that sets up the promotion choice on the board, and set a front-end flag indicating the promotion pseudo-popu is up. The next mouse click would first test this flag, reset it, and call the back-end routine to restore the board and execute the promotion move that was entered.

(To make it feasible to have more than two square colors in xboard we have to do something about the ridiculous way these pixmaps work, which display square and piece at the same time.)
User avatar
H.G.Muller
 
Posts: 3080
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Return to WinBoard development and bugfixing

Who is online

Users browsing this forum: No registered users and 2 guests