The Chess Variant Pages
Custom Search




[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Latest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Comments/Ratings for a Single Item

Later Reverse Order Earlier
This item is a computer program
It belongs to categories: Orthodox chess, 
It was last modified on: 2007-12-15
 By H. G.  Muller. Fairy-MaxThis item is a computer program
It belongs to categories: Orthodox chess, 
It was last modified on: 2007-12-15
 By H. G.  Muller.. Free open source chess variant software.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on 2018-10-06 UTC

I do know that Android compiles of Fairy-Max are available, and that people use it for instance with Aart Bik's 'Chess for Android' app. The latter only supports normal Chess, however, and none of the other variants Fairy-Max plays. WinBoard / XBoard is certainly not available for Android; it would have to be completely rewritten for that. I am not aware of any chess-variant-capable GUIs that can work with engines for Android. I don't have an Android device myself.


lweifjwielfjewfoiwjo lwiejosldfiew wrote on 2018-10-05 UTC

Are there any known Android Apps that use Fairy-Max as their chess engine?


Steven Streetman wrote on 2010-10-26 UTC
Thanks. I will see what I can do.

H. G. Muller wrote on 2010-10-26 UTC
Fairy-Max knows the concept of royal pieces, the capture of which means the
end of the game. You can have more of those, but in that case loss of the
first means loss of the game, so they still would not be allowed to venture
into check. From what you say, I gather your game is different. Which would
mean you cannot play it with Fairy-Max by just changing the piece
definitions in the fmax.ini file.

That of course does not mean that Fairy-Max could not be adapted to handle
the novel winning condition at the level of the C code. I have for instance
made a derivative to play Shatranj, which implements the baring rule as
winning condition, and this required just three extra code lines. To judge how
easy or difficult this would be, requires exact knowledge of the winning
condition.

Steven Streetman wrote on 2010-10-26 UTC
H. G. Muller

Thanks for your suggestion concerning applying Fairy-Max to my chess
variant. I have just starting looking at chess variant playing software and
there are a few. Before I download it and start trying to figure it out I
have a question.

Question:
My chess variation is different in that one side (white) has one King and
the other side (black) has two Kings.  There are, consequently, very
specific rules concerning checking the black King(s) and checkmate. For
example when black has two kings in play they are immune to check but not
immune if they are simultaneously checked. So I am wondering if this
circumstance would preclude the use of Fairy-Max?

H. G. Muller wrote on 2010-01-17 UTC
The version of WinBoard I put on my website (4.20100116) should include this. Unfortunately, Fairy-Max itself does not support Analyze mode, (or any other form of pondering), or the Move-Now command. All these would require Fairy-Max to pay attention to input while it is thinking, and to do that requires different code for Windows and Linux. The lack of these features make the variation support of WinBoard less useful with Fairy-Max.

I would be very curious to know how Fairy-Max is doing against the Thai software. Also if you cn see obvious mistakes it makes. I guessed a value of 300 for the Silver (compared to P=100, M=181, N=450). Another parameter is the promotion bonus: in the last version I lowered that to 60 cP, in stead of using the logical 80 cP (which is the difference between the P and M values) to discourage it from trading Pawns by promoting by capturing a Pawn, and have the Med recaptured. (Or equivalently, promote a Pawn, have the Med captured, and the capture some other Pawn). In general it seems bad to do this, because you effectively trade a Pawn that could promote for another one (that likely could not). Lowering the promotion bonus should cure that. (But it has the undesired consequence that if the Med does get captured and the material gets even again, the score will not go back to zero.)

Pornpong Petchrongrusamee wrote on 2010-01-17 UTC
I saw your comment on winboard forum about variation feature on winbaord, I would like to know whether this feature already add to winboard or it will coming soon. I plays Makruk with Fairy-Max, it is quite strong, so I keep lose it. I have some Makruk software that was programming by Thai, so I will make tournamet between Fairy-Max and them.

H. G. Muller wrote on 2010-01-15 UTC
OK, I have made a new version of Fairy-Max, which supports the 6th-rank promotion, and has Makruk pre-programmed. The Windows version can be downloaded at http://home.hccnet.nl/h.g.muller/fairy.zip . A Linux tar-ball is at http://home.hccnet.nl/h.g.muller/fairymax.tar.gz .

I also tweeked WinBoard a little, to use S and M for the Bishop and Queen, now that Fairy-Max can have different white and black pieces with the same name. (I configured Fairy-Max such that it would understand E and B for S as well, as well as Q and F for M, btw.) The latest version is at: http://home.hccnet.nl/h.g.muller/winboard.zip . Sources (for XBoard) can be obtained at http://hgm.nubati.net , from the git repository.

H. G. Muller wrote on 2010-01-14 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.

Pornpong Petchrongrusamee wrote on 2010-01-14 UTC
That is a good news for Makruk player, I have some suggestions on notation such as using S for Bishop because of it moves like Silver in Shogi and it already well knows in English Shogi notation and using M for Makruk queen because of in Thai we call queen as Med and M is not in a-h file notation so it should be easy to read. Now I try to study your source code and your description on Micro-Max and Fairy-Max, because I want to modify promotion rank. Do you have any suggestion which line I should look for?

I saw this line, but I am working to understand it.
b[y]+=V=y+r+1&S?647-p:2*(u&y+16&32);  /* upgrade P or convert to Q*/

H. G. Muller wrote on 2010-01-13 UTC
It seems that in Makruk I have neglected one of the World's major Chess variants. I surely must correct this omission. I will add it as one of the standard variants that WinBoard / XBoard recognizes.

H. G. Muller wrote on 2010-01-11 UTC
ShaMax and Fairy-Max use the same fmax.ini file, so the automatically play each other's variants. But the search engine of ShaMax is altered to score stalemated as a loss (actually by deleting the code that makes an exception for it and scores it as a draw), and score a bare opponent King as a win.

If I understood the description correctly, you would not need that for Makruk, and it might lead to some really stupid mistakes in the late end-game. (For the rest of the game you would not notice the difference.)

The promotion on 6th is a problem for Fairy-Max. The only way around this I see at the moment is that you would perform the promotion by hand, by using 'Edit Position' in stead of doing your move, or using Edit Position after Fary-Max' move. Pawns on 6th already get a bonus in Fairy-Max, so it might also strive for promotions and resist yours. The bonus is not very high, though: to have it play Shatranj better, I devide the bonuses for normal Chess that were originally hard-coded in the program by 8 if the value of the piece you promote to is less than 250. In Chess you get 64 for a Pawn on 6th, and 128 for a Pawn on 7th. So that would be reduced to 8 and 16, not very much. But in Shatranj (and presumably Makruk) a 'Queen' is of course hardly worth more than a Pawn. So it might not hurt too much, sacrificing a Pawn to make another promote is probably always wrong anyway, so a large bonus is not really needed.

The problem with using Edit Position is that WinBoard considers what you play afterwards as a new game, so you cannot save the entire game if you do that. If there is much interest, I could of course make a dedicated version of Fairy-Max for playing Makruk, which promotes at 6th rank, just like I made ShaMax for Shatranj (micro-Makrux?).

Fairy-Max is indeed an amazingly tough opponent, for an IA of only ~100 lines of code. I guess that tells you how powerful hardware is nowadays. Currently I am trying to have it play Chess with Different Armies. (The Color-bound Clobberers seem to lose pretty badly to the FIDE army, though; perhaps I should revise my piece values!)

Pornpong Petchrongrusamee wrote on 2010-01-11 UTC
Thank you Muller, Fairy-Max plays quite good in Makruk Thai. I forgot to tell that pawns force to promotes to queen when they reach to 6th rank. I played with some Makruk Thai program and I think Fairy-Max is better than my expectation. Can I also used ShaMax as engine to play Makruk Thai by modify ini file?

H. G. Muller wrote on 2010-01-11 UTC
OK, it is a good idea to use Shatranj as basis, because that already has Pawns without double step, a Ferz as Queen, and no castling. The trick here is to consider the black and the white Elephant as different piece types (just as internally Fairy-Max considers white and black Pawns as different piece types). So there are 'upstream' Elephants, which will be indicated by 'B', and 'downstream' Elephants, indicated by 'E'. Then in the initial position I give white upstream Elephants, and black downstream Elephants. So I change the lines for b and e (like you already figured). I guessed a value of 300 for them; you probably know better what they are worth compared to a Knight. I make this descripton replace that for variant 'fairy', though, not shatranj, for reasons that will become clear below:

// Makruk (Thai Chess), sort of
Game: fairy
8x8
6 4 5 3 7 5 4 6
6 4 8 3 7 8 4 6
p:100 -16,6 -15,5 -17,5 
p:100 16,6 15,5 17,5
k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
b:300 15,7 17,7 -15,7 -17,7 -16,7
R:630 1,3 16,3 -1,3 -16,3
q:180 15,7 17,7 -15,7 -17,7
e:300 15,7 17,7 -15,7 -17,7 16,7
f:180 15,7 17,7 -15,7 -17,7

Now the initial position is not quite what it should be, as Fairy-Max always assumes Pawns on the second rank. So you would have to play from a setup position. To do this, make a file named makruk.fen that contains the text:

rneqkenr/8/pppppppp/8/8/PPPPPPPP/8/RNBQKBNR w 0 1

which is the FEN for the initial Makruk position. In variant fairy WinBoard will accept all pieces in FEN diagrams, while in Shatranj it would only have accepted KQRBNP. To play Makruk, you now would have to type in the 'engine' field of the startup dialog of WinBoard

fmax /fd=..\Fairy-Max /variant=fairy /lpf=makruk.fen /testLegality=false

(lpf stands for loadPositionFile.) The first two can already be selected in the combo box, you could type the other options behind it before pressing OK. You can also add this line in the file winboard.ini, replacing the 'fmax' line that is there now in the list of /firstChessProgramNames, or adding it below it, so that you can automatically select it from the combobox of the startup menu.

This is currently as far as you can get. It is not perfect: I see that Makruk has deviating promotion rules, and there is no way to tell that to Fairy-Max through the configuration file. Another, minor annoyance is that the appearence of the Elephant piece is different for black (Elephant symbol) and white (Bishop symbol). I really should fix Fairy-Max to automatically use the mirror images of all pieces for the opposite colors, so that the Elephants could have been programmed as the same piece.

Pornpong Petchrongrusamee wrote on 2010-01-11 UTC
Thank you Muller. I would like to add Makruk Thai to fairy-max and used it with winboard. Makruk Thai is almost same as shatranj variant. The different is only Thai elephant move like Silver in Shogi, Black Ferz interchange place with Black queen in start position and both side pawn start at rank 3 and 6.  please see this for complete rule

www.chessvariants.org/index/msdisplay.php?itemid=MPmakruk(thaiche

I did try to modify some pieces fmax.ini

original
Game: shatranj
8x8
6 4 5 3 7 5 4 6
6 4 5 3 7 5 4 6
p:100 -16,6 -15,5 -17,5 
p:100 16,6 15,5 17,5
k:-1  1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
b:350 30,7 34,7 -30,7 -34,7 change to b:110 15,7 17,7 -15,7 -16,7 -17,7
R:630 1,3 16,3 -1,3 -16,3
q:180 15,7 17,7 -15,7 -17,7
e:350 30,7 34,7 -30,7 -34,7 change to s:110 15,7 17,7 -15,7 -16,7 -17,7
f:180 15,7 17,7 -15,7 -17,7

I save and open winboard gold that use fairy max engine then I pick elephant to move either follow original move or Silver move , then it show illigal move message below white clock and cann't move elephant, but if I use option 'Just view or edit game files', then I can make origin move that mean winboard has pieces move checking.

Could you please tell more how to do? I am Thai and have few programing background.

H. G. Muller wrote on 2010-01-10 UTC
To add a new variant to Fairy-Max, you would have to edit the fmax.ini file. This file is self-documentng: it contains a description of the formt you should use. Bascally this is the name of the variant, the initial array of pieces on the back ranks, (not very important, as you can always start from an arbitrary setup position by loading it at the beginning of the game), and a list of piece descriptions. Each piece description consists of a line starting with the letter used to indicate the piece (in promotion moves) and its value in centiPawn, followed by a list of (step-vector, move-rights) pairs for each direction the piece moves in.

To use a newly defined variant in WinBoard, it would have to have a name WinBoard recognizes. WinBoard is not yet configurable for variant rules. But it provides a catchall variant name 'fairy', so you could simply call your new variant 'fairy'. If it contains pieces that are not pre-programmed in WinBoard, you could still play it with legality testing off. Even with legality testng on, WinBoard supports a few piece types for which it accepts any move.

What you cannot do is use pieces whose moves have side effects. (e.g. mat's catapult pieces, Ultima pieces that do use other capture modes than replacement captures, etc.) Fairy-Max is not made for that type of variants. It only served the more limited purpose of evaluating conventionl Chess pieces with deviating move patterns.

What variant did you have in mind?

Pornpong Petchrongrusamee wrote on 2010-01-10 UTCGood ★★★★
How to add new variant chess to Fairy-Max? and if I used Winboard F for GUI, do I need to do something on Winboard F?

H. G. Muller wrote on 2008-10-10 UTC
Well, I am not sure if you will be able to run GNU Shogi. The DemoPack was
made on a now-deceased PC running Win2k. I downloaded it on my WinXP
laptop, and the GNU-Shogi executable does not want to run there. It
crashes immediately, even if I try to directly run the executable, without
WinBoard. If I run it from a command-prompt box, so that I can see the error
message, it complains about an incompatible cygwin1.dll.

So I guess the cygwin1.dll that my current system has loaded is no longer
compatible with the GNU Shogi executable. The DemoPack does contain a
cygwin1.dll that is compatibl with GNU Shogi, butit cannot load if another
cygwin1.dll is already in use.

If you don't run cygwin on your PC, or otherwise can lay your hands on a
GNU Shogi that runs on your PC, it should run with the WinBoard and
InBetween settings in the DemoPack.

H. G. Muller wrote on 2008-10-10 UTC
If you would view my entire forelast message, you will also see at the bottom the links to some other engines, amongst which TJshogi and TJxiangqi. :-)

GNU Shogi will not directly run under WinBoard. (It is not truly WB
compatible, although the Chess engine from which it was derived was.) I
did succeed in running GNU Shogi under WinBoard with the aid of a general adaptor program that was configured for interchanging the command 'black' and 'white'. The complete setup for this is still on my website as

http://home.hccnet.nl/h.g.muller/DemoPack.zip

This contains a quite old WinBoard version, though. I am also not sure if
you can automatically play TJshogi gainst GNU Shogi, as I am not sure if
they both use the way to indicate square coordinates. TJshogi might use a1
where GNU Shogi uses 9a. Now WinBoard has a command-line option to tell it
which coordinates to use, but currently will use the same coordinates for
both engines. This is another thing on my to-do list, to make this
separately configurable for each engine.

The DemoPack also contains the executable of HoiXiangqi (the website of
which seems to have diappeared).

Fergus Duniho wrote on 2008-10-10 UTC
Do you know of any engines that handle Shogi or Chinese Chess? Will
Winboard_F work with GNU Shogi?

H. G. Muller wrote on 2008-10-09 UTC
OK, I have made new version of WinBoard, that acts a little more user
friendly if you select a variant that the first engine does not support.

I did not find an easy fix for the second engine; this is only used in the
mode where you have two engines play each other, and not initialized, or
even touched before you actually select 'Two Machines' mode. So you
might change the variant without WinBoard being aware which variants are
supported by the second engine. And this should not be considered an error
anyway, because you might not even want to use the second engine. (It would
be very annoying if you have to specify an engine that you don't want to
use.)

Anyway, thanks for pointing this out. The updated version (WinBoard +
Fairy-Max packaged together) can be downloaded from:

http://home.hccnet.nl/h.g.muller/WinBoard_F.zip

H. G. Muller wrote on 2008-10-09 UTC
Fergus: | I have tried running Winboard-F with Fairy-Max, but when I select a | variant, it frequently tells me that the variant is not supported by | Fairy-Max 4.8C. What is the latest stable version? How can I make sure | I have it installed? The latest version (now on my website) would say Fairy-Max 4.8E and in thw WinBoard 'Help->About...' menu WinBoard 4.3.15h. But none of the earier versions is particuarly unstable. The problem is merely that Fairy-Max indeed does not support all variants. You should realize that WinBoard and Fairy-Max are completely independent developments, and that Fairy-Max is merely one of the hundreds of engines that can be run under WinBoard. (Most of these play only normal Chess, of course.) I agree that the response of WinBoard, to simply exit if one requests an unsupported variant, is perhaps a bit harsh and user unfriendly. I guess this stems from the time the variant could not be changed at run time through a menu, but only on startup through a command-line option. In that case there was no way to give a new variant if the one specified in the command-line option was not supported by the engine, so no fix was possible. I will put it on my to-do list to 'grey out' the variants the engine does not support in the 'New Variant' menu. As a temporary measure I will maintain the error popup for unsupported variants, but make it a non-fatal error, and simply keep the old variant in force if the newly selected variant is unsupported by the engine. (Treat it equivalent 'pressing 'Cancel'. The version of Fairy-Max in the download only has definitions for the variants: normal, shatranj, courier, knightmate, capablanca, , falcon, cylinder, berolina, super. To play other variants with WinBoard you would have to download other engines. e.g. Pulsar by Mike Adams (losers, suicide/giveaway, 3checks, crazyhouse, atomic) ( http://www.adam16mr.org/pulsar.html ) TJchess by Tony Hecker (separate versions for crazyhouse, shogi, xiangqi, capablanca) ( http://tonyjh.com/chess/ ) SMIRF by Reinhard Scharnagl (e.g. CRC, FRC, Capablanca, Janus) ( http://www.chessbox.de/ , but needs adapter which was included in the WinBoard download ) And of course add shortcuts to start up WinBoard using those engines, or start WinBoard without the aid of any shortcut, and select the name of the engine you want (or type it) in the WinBoard startup dialog.

Fergus Duniho wrote on 2008-10-09 UTC
I have tried running Winboard-F with Fairy-Max, but when I select a
variant, it frequently tells me that the variant is not supported by
Fairy-Max 4.8C. What is the latest stable version? How can I make sure I
have it installed?

Sam Trenholme wrote on 2007-12-31 UTCBelowAverage ★★
This is a developers-only snapshot of a program that may become a usable chess variant engine. However, there are a number of issues that need to be worked out:
  • There is no documentation on how to actually use fairy max. The only way to figure out how to use the program is to read the C source.
  • The C source code does not contain any license text. I would like to know under what license the program is released, and whether the terms are OSI-approved Open Source compatible (GPL, etc.)
  • The program itself has no built-in help
  • There is also WinBoardF, which has support for a few chess variants. However, there is no documentation about how to interface WinboardF with fairy max.
Unlike SMIRF and ChessV, there is no convenient way to use this program to actually play any chess variants (In both of those cases, it was simply a matter of selecting a variant, telling it to play white or black, and start playing). I can see most of the pieces are in place; once there is documentation about hooking up Fmax (or Joker) to WinboardF, this will probably be a playable and enjoyable variant engine.

- Sam

P.S.: I will change my rating once documentation is available to actually interface fairy max with WinboardF. I will change my rating to one even higher if a well integrated fairy max + WinboardF package is made, which doesn't require any messing around with .ini files to play fairy chess against the computer.


24 comments displayed

Later Reverse Order Earlier

Permalink to the exact comments currently displayed.