Author Topic: How to download Fairy-Max?  (Read 201 times)

Asher Hurowitz

  • Administrator
  • Full Member
  • *****
  • Posts: 135
  • The Founder and Administrator of the Forum
    • View Profile
How to download Fairy-Max?
« on: January 23, 2018, 12:11:11 pm »
I was told that there was this amazing software that could play custom variants and wanted to use it among other things and general personal usage for the current forum design contest. Where can I download this program?

Thanks!
Indeed it is certain that Chess Variants make me happy.

My Youtube Channel on Chess Variants
https://www.youtube.com/channel/UCb-lm6a8XZo0eqAhfR4QWOg

My Lecture at Yale University, aged 13
https://www.youtube.com/watch?v=smDO2Dpx5tg

My Youtube Channel on Rubik's Cube
Search"Polyhedral Paradise"

Share on Facebook Share on Twitter


HGMuller

  • Global Moderator
  • Full Member
  • *****
  • Posts: 122
    • View Profile
Re: How to download Fairy-Max?
« Reply #1 on: January 23, 2018, 04:56:23 pm »
The most recent version is packaged together with the WinBoard GUI beta version, which can be downloaded from http://hgm.nubati.net/WinBoard-AA.zip . Just unzip the file in a location of your choice, and start the winboard.exe in the WinBoard folder contained in it. This is Windows software, btw; if you run on Linux or a Mac, you would have to use XBoard.

Note that Fairy-Max is an engine, i.e. not equiped with any graphical interface, and is designed to run under the WinBoard/XBoard GUI. It is configurable for a range of variants of various board sizes, and supports a wide variety of piece moves (leapers, riders, hoppers). It doesn't support any side effects (other than castling or e.p. capture). The variant can be defined in the fmax.ini file, which also contains an explanation on how to do this. Unfortunately the definition format is not very user-friendly.

Fairy-Max is not unique as a user-configurable chess-variant engine, BTW; there are other engines, also running under WinBoard, which can also be configured. Often in a more user-friendly way. In particular, I want to mention Daniel Shawul's engine Nebiyu, and Evert Glebbeek's engine Sjaak II. If you have downloaded the WinBoard package mentioned above, you should be able to also download these, and set up WinBoard to use them through the Load Engine dialog.

GothicChessInventor

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Re: How to download Fairy-Max?
« Reply #2 on: January 23, 2018, 05:39:30 pm »
I was told that there was this amazing software that could play custom variants...

Are you thinking of the Zillions of Games engine?

HGMuller

  • Global Moderator
  • Full Member
  • *****
  • Posts: 122
    • View Profile
Re: How to download Fairy-Max?
« Reply #3 on: January 24, 2018, 10:03:06 am »
As there were already questions about this in another thread (where it was a bit off-topic), it might be a good idea to explain that here.

For one, the package consist of a GUI (WinBoard), responsible for displaying the board, entering the moves through mouse clicks, stepping through games, saving games on files or reading them back for review. This acts as a 'front end' for an AI, a.k.a. engine, (Fairy-Max), which is responsible for thinking uo good moves. To implement a new variant so that you can play it against the computer requires both the GUI and the engine to be made aware of the rules.

Note that WinBoard can also be used as front end for other engines than Fairy-Max. I fact there are thousands of engine that can be used as AI for WinBoard. Most of those only play orthodox Chess, of course. Some are dedicated to another variant, such as Chinese Chess or Shogi. Some engines can play various variants, e.g. Pulsar can play orthodox Chess, Suicide Chess, Atomic Chess, Shatranj, Crazyhouse and Three-checks. Of interest here are engines that can be configured by the user for playing any variant within a certain range of parameters (like maximum board size, maximum number of pieces). There even exist several of those, e.g. Fairy-Max, Nebiyu and Sjaak II. WinBoard is able to play two engines that support the same variant against each other, or even conduct tournaments for more than two such engines.

Configuring WinBoard

In principle it is possible to configure WinBoard for a new variant without involvement of any engine, e.g. to use it as a viewer for games played between humans. This can be done through a number of options. These can be specified in the 'Additional options' field of WinBoard's startup dialog. But it is more convenient to write them all in a file, say xxx.ini. Then you would only have to type @xxx as 'Additional option', and WinBoard would insert the contents of the file in that place. Otherwise you would have to retype all the options everytime you want to start WinBoard for that variant.

A variant has to be specified to WinBoard as a modification of some other, standard variant of which it knows the rules. Unless overruled, the game rules will be those of that 'parent variant'. Things like wheher stalemate is a draw, king baring is a win, captures are mandatory, capturing pieces explode, pieces in hnd can be gated onto evacuated first-rank squares and such currently can only be specified through the parent variant. Game properties that can be overruled are board size, participating pieces, how the pieces move, start position, whether pieces can be hold in hand. E.g. the following xxx.ini could be used to define a game on a 10x10 board with an Elephant and a Cannon as extra pieces

-variant capablanca
-boardWidth 10
-boardHeight 10
-pieceToCharTable "PNBRQ.E....CKpnbrq.e....ck"
-fen "rnbcqkebnr/pppppppppp/10/10/10/10/10/10/PPPPPPPPPP/RNBCQKEBNR w KQkq - 0 1"
-men "C:mRcpR;E:FAsmW"


Here 'capablanca' is a variant known to WinBoard, with rules similar to orthodox Chess, very suitable as parent variant for western Chess variants. The board width and heigt speaks for itself. The pieceToCharTable is a list that for each image WinBoard supports indicates which piece in the game will use that image ('.' indicating the corresponding image is not used in the game. The order of the letters in this string corresponds to the following images:



The last piece of each color is always King, all other letters are images starting at the upper-left, and unmetioned images are supposed not to participate. So i this case the orthodox pieces are selected, in adition to an Elephant (using ID = E) and a Cannon (using ID = C). The -fen option then defines the start position in terms of these piece IDs.

Finally the -men option defines how pieces move; for each ID it specifies a move in Betza notation after the following colon (':'); the different pieces are separated by semicolons (';'). In this case only the Cannon and the Elephant moves are specified. For pieces that are not specified in the -men option, WinBoard will use the default move for the corresponding image. For the orthodox pieces this is of course what you would expect. (And for the Cannon, which is described here as the piece from Chinese Chess, moving as Rook and capturing as a Rook hopper, the default move would probably have been sufficient as well.) The Elephant is described as moving and capturing one or two squares diagonally, or moving one step left or right, which definitely is different from what WinBoard would think without this move override.

Next time more about configuring Fairy-Max.

ebinola

  • Jr. Member
  • **
  • Posts: 77
  • Location: nowhere in particular
    • View Profile
Re: How to download Fairy-Max?
« Reply #4 on: January 24, 2018, 04:37:43 pm »
Plugging that into an .ini file just spits out this for me. Not sure what's going on here. :/

EDIT: Also, how do shogi-like promotions work? Say if I wanted a variant where a gold can promote to a goldrider, how would I go around doing that?
« Last Edit: January 24, 2018, 05:26:01 pm by ebinola »
Chess player, amateur writer and on the side shitposter extraordinaire.

HGMuller

  • Global Moderator
  • Full Member
  • *****
  • Posts: 122
    • View Profile
Re: How to download Fairy-Max?
« Reply #5 on: January 25, 2018, 05:24:27 am »
Just to make sure: the WinBoard version you are using is 4.9.xxx ? (Visible in the Help -> About WinBoard menu.) From you screenshot it is obvious that WinBoard must have seen the -boardHeight 10 option, but it seems to have ignored the FEN, and uses the default setup for Capablanca. (Because that still fits the specified width; the Pawn placement follows the board height, when trying to fit a position on a board of non-standard size.)

Older WinBoard versions do not support the -fen option (you would have to specify a -loadPositionFile (-lpf for short) with the FEN for the position in it, which was a bit cumbersome). So this could be a possible explanation.

As for Shogi promotions: In the pieceToCharTable you can define an image as a two-character combination ^X , which then indicates that image should be used for the promoted form of X (and by inference that X can promote when reaching the promotion zone). In FEN and SAN WinBoard would use the notation +X for such pieces. Note, however, that Fairy-Max does not support promotion of pieces other than Pawn. But Sjaak II might.
« Last Edit: January 25, 2018, 05:51:42 am by HGMuller »

ebinola

  • Jr. Member
  • **
  • Posts: 77
  • Location: nowhere in particular
    • View Profile
Re: How to download Fairy-Max?
« Reply #6 on: January 25, 2018, 12:58:45 pm »
Ah, I've been using 4.8! I couldn't find a download link for 4.9. Thanks!
EDIT: Oh, and one more thing... how would I go about adding extra royal pieces to a game, like the drunken elephant?
« Last Edit: January 25, 2018, 01:45:54 pm by ebinola »
Chess player, amateur writer and on the side shitposter extraordinaire.

HGMuller

  • Global Moderator
  • Full Member
  • *****
  • Posts: 122
    • View Profile
Re: How to download Fairy-Max?
« Reply #7 on: January 25, 2018, 02:37:31 pm »
WinBoard 4.9 is currently only available as a beta version, at http://hgm.nubati.net/WinBoard-AA.zip .

You can use -variant chu as parent variant, and use the second King (shown in black) as the promoted version of the Elephant.

HGMuller

  • Global Moderator
  • Full Member
  • *****
  • Posts: 122
    • View Profile
Re: How to download Fairy-Max?
« Reply #8 on: January 26, 2018, 02:15:59 pm »
I just updated the WinBoard-AA package (at the above link), to fix a problem in WinBoard with setting up positions in combination with an engine, and enhance Fairy-Max to allow Pawns with initial double push on more advanced ranks than the second, iron pieces, and board widths up to 14.

Configuring Fairy-Max

A game definition in Fairy-Max consists of a list of definitions of the participating pieces, preceded by the game name, board size and initial setup. Such definitions can be written in the fmax.ini file, one after the other. A piece definition takes a single line. E.g. for a Rook, this would be

R:500 16,3 -16,3 1,3 -1,3

The leading 'R' gives the name under which the piece is known, used to send a posiion the user sets up in the GUI to the engine. The '500' after the colon is the piece value that Fairy-Max should assume for this piece (in centi-Pawn). That 'R' is used as name, rather than 'r', indicates to Fairy-Max the piece should not be drawn towards the center. The remaining pairs of numbers are the 'board step' and the 'mode'. The board step is 16 times the rank step, plus the file step. Stepping in the direction of 1st rank or h-file (on 8x8 boards) would be considered positive. So the first two pairs specify single steps along a file, the last two single steps along a rank.

The 3 for 'mode' means the move is an unlimited-range slide that can both be used for moving (to an empty square) and capturing. The mode always is the sum of the individual capabilities, 1 meaning the move can capture, 2 meaning it can move (to empty), and 4 meaning it must stop after this step (i.e. the move is a leap rather than a slide). With this we can see a Knight and a (white) Shatranj Pawn should be defined as:

N:325 31,7 33,7 14,7 18,7 -31,7 -33,7 -14,7 -18,7
P:60 -16,6 -15,5 -17,5

Pieces with asymmetric moves, like Pawns, must be defined separately for white and black. To this end a piece ID can be used multiple times. The first definition for that ID is then used for white pieces of this type, the last definition for black pieces. Fairy-Max will consider the first two pieces that are defined (number 1 and 2) to be Pawns, meaning it will assume they promote when they reach the promotion rank. In its own thinking Fairy-Max will always promote Pawns to piece number 7. So it will never consider under-promotion, and you should make sure that the most-likely promotion choice is defined as piece number 7. (For orthodox Chess this would of course be Queen.) Otherwise the order of the definitions is arbitrary, although performance benefits a bit if they are ordered from low to high value. Under-promotions from the opponent will be accepted.

Absolute royalty is indicated by specifying the value of a piece as -1. Such pieces may not be left in check, and loss of any of them would mean loss of the game.

There can be at most 15 different piece types in a variant.

Initial moves (that only virgin pieces can do) must be defined separately from the 'normal' moves, and will all have a 'mode' that ends on '4', and has a digit before that to indicate what the second step of this move can do. (This digit will be added to the '4'.) That means Pawn double pushes would need mode 24 (the 2 indicating it can only move, not capture with this double push). Initial moves of a royal piece are assumed to be castlings with the corner piece (whatever type that may be, as long as it is virgin as well).

Initial setup

Each variant you define should have a 'default starting position'. This position suffers some restrictions: it must consist of a back rank filled with pieces, and somewhere in front of it a rank filled with Pawns. Positions that do not fit this requirement can be set up through the GUI; the default position then only affects which of the pieces in the externally fed position will be considered virgin. Any Pawn on or behind the Pawn rank of the default start position will be considered virgen, and any back-rank piece that is in the same place as it would be in the default start position.

The default start position is specified in 2 lines directly above the piece definitions, one for the white back rank, the next for the black back rank. It will contain the piece-type numbers (corresponding to the order of  the definition lines), separated by spaces, for each square on the back rank. Normally the second rank would be filled with Pawns automatically.

Board dimensions

Above the specification of the start position we have a line that specifies the board size, as two numbers separated by 'x'. E.g. 10x8 . The first number is the board width (number of files), the second the board height (number of ranks). The maximum number of ranks is 16. The maximum number of files is 14, but only if there are no pieces that leap more than 2 files laterally. If pieces are present that can make larger sideway leaps, the board needs to be correspondingly narrower to prevent them from leaving the board o one edge, and appearing in it at the other.

You can also define Pawn rank and depth of the promotion zone here, by writing '=N' behind the board size if you want the Pawns to start on the Nth rank. E.g. 8x8=3 for Makruk, where Pawns start on 3rd rank. Then the depth of the promotion zone will also be assumed to be 3 ranks deep. If you just want to move up the Pawns, but keep the zone a single rank deep, you would have to specify a negative N.

Header

At the top of the definition there will be a line specifying the name of the variant, preceded by the word Game, a colo and a space. Like

Game: capablanca

In this form the name must be a standard variant known to WinBoard, or WinBoard would not allow you to select it. However, if you changed the board size in WinBoard (through the -boardWidth or -boardHeight option), WinBoard will change the standard name by prefixing the board size. E.g. it knows that variant capablanca is normally played on a 10x8 board, so if you overrode that by specifying 10x10, the variant gets called 10x10+0_capablaca, and must be defined as such in Fairy-Max:

Game: 10x10+0_capablanca

Above that you can put an arbitrary number of comment lines, startig with '//'. They are basically just for the convenience of the user writing the defiition. Although Fairy-Max will show a button in its Engine Settings dialog in the GUI that you can press in order to see the last such line before the definition proper. So you could use that to give a short description of the variant.

Example

The fmax.ini file already contains many examples, but a simple one is that for Knightmate:

// The King (Unicorn) moves as a Knight, and vice versa. The Unicorn can castle!
Game: knightmate
8x8
6 4 5 7 3 5 4 6
6 4 5 7 3 5 4 6
p:74 -16,24 -16,6 -15,5 -17,5
p:74  16,24 16,6 15,5 17,5
k:-1  1,34 -1,34 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7
m:222 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7
b:296 15,3 17,3 -15,3 -17,3
R:444 1,3 16,3 -1,3 -16,3
Q:851 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3

« Last Edit: January 26, 2018, 02:40:22 pm by HGMuller »

GothicChessInventor

  • Full Member
  • ***
  • Posts: 176
    • View Profile
Re: How to download Fairy-Max?
« Reply #9 on: January 26, 2018, 07:50:50 pm »
A game definition in Fairy-Max consists of a list of definitions of the participating pieces, preceded by the game name, board size and initial setup. Such definitions can be written in the fmax.ini file, one after the other. A piece definition takes a single line. E.g. for a Rook, this would be

R:500 16,3 -16,3 1,3 -1,3

The leading 'R' gives the name under which the piece is known, used to send a posiion the user sets up in the GUI to the engine. The '500' after the colon is the piece value that Fairy-Max should assume for this piece (in centi-Pawn). That 'R' is used as name, rather than 'r', indicates to Fairy-Max the piece should not be drawn towards the center. The remaining pairs of numbers are the 'board step' and the 'mode'. The board step is 16 times the rank step, plus the file step. Stepping in the direction of 1st rank or h-file (on 8x8 boards) would be considered positive. So the first two pairs specify single steps along a file, the last two single steps along a rank.

You're going to have to explain these numbers in more detail H.G.

HGMuller

  • Global Moderator
  • Full Member
  • *****
  • Posts: 122
    • View Profile
Re: How to download Fairy-Max?
« Reply #10 on: January 27, 2018, 07:40:07 am »
Well, after the ID and piece value, there are 4 pairs of numbers. Each such pair corresponds to a certain direction that can be moved in.

The first number of each pair gives the elementary step in that direction, and is equal to 16 times the ('vertical') rank step plus the ('sideway') file step. To deduce the step from the value (which is what you normally don't have to do; then you know the step, say (1,2) for a Knight, and just calculate 2*16+1 = 33), you would have to write the number as 16*Y + X. For 16 this would give 16*1 + 0, i.e. a step (X, Y) = (0, 1). Similarly, the -16 would give (0, -1) and 1 would give (1, 0). So the mentioned directions are the basic orthogonal ('Wazir') steps.

The second number of each pair (here always 3) indicate what the piece can do. Here 1 means capture, 2 means non-capture. Since 3 = 1 + 2 it means the R can both capture and non-capture in all four orthognal directions. A 4 here would mean 'terminal', i.e. the move would terminate after a single step. So if the second number would have been a 7 = 4 + 2 + 1, it would have described an orthogonal leaper (the Wazir) stepping to neighboring squares, but never beyond, and able to capture and non-captture there. But the 3 that is actually there does not contain a 4 coribution, so the move will not terminate after the step, but be able to repeat it indefinitely, as long as there are no obstacles. I.e., the piece has a slider move in all orthogonal directions, and is an orthodox Rook.

Fancy move modes

Now that I am elaborating, I might as well touch on the topic of more complex moves than ordinary steppers/leapers or sliders/riders. Because actually moves in Fairy-Max are always considered two-stage moves. Meaning that after the first step (if the move is not specified to terminate there, by a 4 contrinution in the mode) everything can change. And 'everything' really means everything: both the step direction and the mode can change.

To indicate the change in mode, another digit is prefixed to the initial mode. In this digit the 1, 2 and 4 contribution have the same meaning as in the final mode digit: 1 = capture, 2 = non-capture, 4 = terminate. Except that they only specify what should change between first and second step. This was done for convenience: in the overwhelming majority of cases we deal with pieces that do not change anything between their first step and the later steps of their move (i.e. normal sliders; leapers do not even have a second step). And then the digit specifying the change has to be 0, i.e. doesn't have to be written at all. Only for true two-stage moves you would need a two-digit mode.

One application of a two-stage mode is for range-two sliders. If the final mode digit is a 3 (i.e. capture as well as non-capture), but the prefixing change digit is 4, (so mode = 43) the primary mode would change after the first step from non-terminating to terminating. (Its capture and non-capture ability would not change.) So it would terminate after at most two steps (if an obstacle did not block it before). Another common case is a non-jumping ('lame') leaper, which can be blocked on a square where it cannot go. There you would need mode 70, indicating that on the first step the move cannot do anything at all (neither end as a capture nor as a non-capture), but it also doesn't specify termination, so it can just 'pass through'. On the second step the prefixed 7 makes this all change: it can then both capture and non-capture, but must terminate (so there is no third step).

It is also possible to change the direction in the second stage of the move; to do this you would need to add a second step behind the mode, separated from it by a comma. So a move specification 17,3,1 would specify a sliding move that starts with a diagonal step (17 = 16 + 1 -> (1,1)), and then continues its trajctory in the (1,0) direction (i.e. orthogonally). This is a so-called bent slider.

Hoppers

Besides sliders and leapers, Fairy-Max also supports 'hoppers', i.e. moves that first must pass over an occupied square before they can settle on another square. A contribution 8 to the final mode digit indicates the move can hop. In this case the two stages are defined a bit differently than with sliders: the second stage does not start after one step, but only after the first encountered obstacle. In case of a hopper there should always be a digit prefixed to the primary mode to indicate that the hopping ability switches off in the second stage. Otherwise the piece would be forced to hop forever, and the move could never terminate.

E.g. the Cannon from Chinese Chess is a hopper that can non-capture before the first obstacle, and capture after it, bth with (orthogonal) sliding moves. Its moves would be indicated like 16,BA. Because the 8 contribution can make the total of the mode larger than 9, we continue counting with A=10, B=11, ... etc. (So these are really hexadecimal digits.) So in the first stage (before the obstacle) the mode would be 8 + 2 = A, meaning that it can only move (not capture), but does not haveto terminate after the first step, and can move as far as needed to encounter the obstacle to hop over. The change prefix is B = 8 + 2 + 1, meaning that in the second stage (after clearing the obstacle) the move loses its hopping ability, loses the ability to non-capture, and acquires the ability to capture. It still doesn't have to terminate after one step, so it can capture targets arbitrarily far behind the 'screen'. If the change prefix had been F = 8 + 4 + 2 + 1, it would have switch on the 4 for forced termination after one step. So it could only capture a piece directly behind the screen. The famous Grasshopper piece would thus have moves defined like 16,F8, indicating it cannot do anything before the screen (just passig through arbitrary many squares), and can both capture and non-capture behind it, but only on the square immediately behind it.