💡📝H. G. Muller wrote on Thu, Jan 14, 2010 11:02 AM UTC:
You identified the correct line; unfortunately this is the most cryptic line of code in the entire micro-Max program. Amongst other things, it caluclates a value for the variable V, which is later added to the piece code on the board (b[y], y is the destination square) to perform promotion. But promotion actually happens in 3 steps in micro-Max; when a Pawn reaches 6th rank or 7th rank the code for it is already altered to indicate its increase in value (for if it is captured), by adding 64 to the piece code. (But these 'heavy Pawns' are still recognized as pieces that move like a Pawn, as the move generator ony looks at the lowest 4 bits of a piece code.)
To save characters (the purpose of micro-Max was to make it as small as possible) the variable V is also does double duty to count for the score, so stepping to 6th rank or from 6th to 7th earns 64 centi-Pawn. Stepping to 8th rank finally produces a Queen code on the board, and supplies the remainder of the score bonus.
Now for Makruk this is in fact very convenient: if V ends up non-zero after that line, you would have a Makruk promotion. Adding the line
if(V)b[y]=u|7,V=640;
directly behind it would do this. (It sets the piece code to 7, the code for the Med, and assigns a bonus of 80 centi-Pawn, as V is still devided by 8 in the next line for games with a Queen value below 250. (And the fmax.ini defined it as 180 for Makruk.) This would then happen in every variant, however, so it would break Fairy-Mx for playing any other vriant thn Makruk. To prevent that, we could write in stead:
if(V&&w[7]==181)b[y]=u|7,V=648;
and then make the value of the queen in the fmax.ini file 181 (and make sure it is not 181 in any other variant) as a way to activate the line. Then we would not have to change the format of the fmax.ini file to include an explicit promotion-zone width.
Anyway, a beta version of WinBoard that supports Makruk can now be downloaded from
http://home.hccnet.nl/h.g.muller/winboard.zip .
This still uses B/E for the white and black Bishops, and Q for the Med. I only want to change that to S and M after I fixed Fairy-Max to handle mirror-image white and black pieces under the same name.