## FANDOM

135 Pages

Index: No. 7.99.01$002 Bensaħas notation is very similar to its rival the Ħasínū notation. Named after Bensaħas Terte Pur "Nevenyad", it was more computer-code-like than Ħasínū. This is why it is the notation that was eventually ported to Meta1. ## SyntaxEdit A move, in most chess variants, is divided into two parts: • Its range, which shows where it can move, and • Its action, which shows what it can do once it's there. For an example: let's take the Wazir, which moves or captures one square in all four orthogonal directions. Its range is "one square in any orthogonal directions", and the action is "move or captures". It's counterpart, the Ferz (moving or capturing one square diagonally in each direction) would have a similar action, but a different range – one square diagonally in each direction. Bensaħas uses this model to describe chess pieces: Action(Range) Or, substituting the names for the definitions: What can the piece do once it's there(where it can move) ## Example and analysisEdit We shall look at three chess pieces encoded in Bensaħas notation and analyze the code. ### Example one: FIDE RookEdit The FIDE rook is a very simple piece. It travels in any orthogonal direction for as long as it pleases. Orthodox Chess:Rook { (n, 15)! }  The brackets at the top indicate the name of the piece, as well as the game it appears in. When writing about a piece they can be omitted. As an alternative, just the name of the game may be omitted, which will make the beginning of the code look like this: :Rook {. Direction numbers in Bensaħas notation Direction Number North 1 East 2 South 4 West 8 Northeast 16 Southeast 32 Southwest 64 Northwest 128 Note: north counts as "pointing towards the enemy at the start of the game". The infinite direction is indicated by the n. "All orthogonal directions" encode to "15" by adding the values on the table to the right of this paragraph. In this case, North + East + South + West = 1 + 2 + 4 + 8 = 15. The exclamation mark ends the move description for that bracket, and the big curly bracket at the end concludes the description of the piece. ### Example two: FIDE PawnEdit If you don't know already, the Pawn has the most complex move in FIDE Chess. It can, on its first move: • Move one square forward, or if the path is clear, two squares, both without capturing; and • Move one square diagonally forwards to capture. After that, it can move: • Move one square forward without capturing; and • Move one square diagonally forwards to capture. • If an adjacent pawn double-moves on its first turn and evades the two squares attacked by the pawn, it may capture it anyway. This is called en passant, for those who don't know. It may also promote into Thus, the code is significantly longer than the Rook's: Orthodox Chess:Pawn { m(2, 1: @M = moved, 1)! m(1, 1)! c(1, 144)! igui(1, 2: @T = E<Pawn, @B = and([n, 5], not/exist(1, 16, @T: @M = relative, -1)) m(1, 16)! igui(1, 8: @T = E<Pawn, @B = and([n, 5], not/exist(1, 16, @T: @M = relative, -1)) m(1, 128)! flip(condition = [n, 8], promotes_to = (n, 255)! (n, 15)! (n, 240)! (n, 255; 1, 2)! )!  The first line states the name of the game and the name of the piece. What follows is kind of complicated so it is split into several headers. #### Lines 2 to 4: @ notationEdit The second line introduces the @ notation, which is very important because they act as parameters. Together with more complex functions, they can further describe a piece's move. Here, it says that it may move (the m) two squares (the 2) north (1) given that (:) it has moved (moved) once ("1" is encoded by the 1; the "time" is notated by the @M itself, which stands for at move....) Since m(1, 1) is included by m(2, 1), there's no need for the third line to include a time variable. Same with the third move; the Pawn's capturing movements never changed, there's @ notation used either. #### Line 5: Thinking laterallyEdit What follows is the description of en passant. Fortunately, the laws of Chess are very much like mathematical calculation. In maths$ (x + y) + z = x + (y + z) \$; these are two ways that lead to the same path. So rather than checking whether or not a neighboring pawn has made a double move, we can do this: we give the pawn an extra move called "igui" (Japanese for stationary eating), termed in English as "Rifle capture". This gives the ability for the piece to capture without moving. So let us give the pawn the ability to capture a piece that is directly to the East or West of itself. To make it simple, we'll consider just the East for now.

We have to limit that however, because with just igui(1, 2) we can capture anything! So we put several parameters at the end to reduce that power to what we want. First, @T = E<Pawn restricts the pieces targetted to just pawns. Not just any pawns, but enemy pawns.[1] Then, the [n, 5] in @B = and([n, 5], not/exist(1, 16, Pawn: @M = relative, -1))[2] only allows the capture to happen at the fifth rank.

To ensure that it is an en-passant, we have to check that the target isn't there one move ago. This is handled by the not/exist(1, 16, @T: @M = relative, -1). Spelled out, we are checking that something does not exist (the slash is syntactic sugar; as the not() function has only one argument its brackets can be replaced by the one for exist) 1 square in the northeast. This something is the target. We are checking if it does not exist one move (the 1) ago (the minus, and also the word "relative", which puts the pawn's current move at 0.)

#### Line 6: The missing exclamation markEdit

But of course, the pawn cannot rifle capture. After it takes its enemy it must move. Fortunately, it is a specific location, so that's not hard.

First, notice that at the end of line 5 there is no exclamation mark. This tells you that if you do whatever you have to do in line 5, you have to do whatever is on line 6. All we have to do now is to instruct the pawn to move northeast by one square after it finishes rifle-capturing everything. Then you're finished, so add an exclamation mark to the end of line 6.

Congratulations, you've made it through en-passant! So let's see something simpler.

#### Lines 7 to 8: ReflectionEdit

Of course, we've only done the East parts of the move. The West parts of en-passant has not been encoded yet. That is, however, very simple. All we have to do is to copy our hard work from lines 5 to 6 and change all the "East"s to "West"s and "Northeast"s to "Northwest"s. With the numbers, it just means changing the 2 into and 8 and the 16 into a 128. That's it.

#### Lines 9 to 11: PromotionEdit

Promotion's handled by the "flip" property, after Shogi's use of flipping pieces upside-down to indicate promotion.

First, you must write down what the Pawn has to do in order to promote. Since it has to go all the way to the eighth rank to get the promotion, all you have to do is to state "whenever it hits something that is y-coordinate 8, then it is eligible." This is done by the square brackets []; they state the absolute position of a space (the one relative to a certain square on the board.) We always define, on a rectangular board, for the bottom-left corner to be [1, 1], so the top rank will be [something, 8]. Now the something can be anything, so that's why we use the n, which means any number.

Finally, we list out the pieces that it can promote to. This is very simply the Rook, the Knight, the Bishop and the Queen. To list them we just stick the piece codes together. Note the Knight, which moves obliquely; the actual heading is given by the 2, 1, and all the numbers are rotated clockwise by half a graduation (see Figure 1.)

Note: when you have a compound piece, you must separate each potential promoted piece with a tilde ~. In this case though they can be omitted.

When we're done with that all we have to do is to close everything, and we're done.

### Example three: ChameleonEdit

This piece is from Ultima and is a very complex piece: it captures the same way as its victim. In the game of Ultima, its code is as follows:

Ultima:Chameleon {
m(n, 255)!
c/cannon(n,  15; n, FE, 1, -1, screen: @T = Pincer Pawn)(1, /4)
+ n, 255; n,  E, n,  n, screen: @T = Long Leaper)!
c/near(n, 255; 1, /4, n: @T = Withdrawer)!
igui(@P = [pos_x(self), pos_y(F<King)][pos_x(F<King), pos_y(self)], @T = Coordinator)!
immobilize(1, 255: @T = Immobilizer)!
c(1, 255: @T = King)!
}


Looking back it seems that I have the Pawn and the Chameleon the wrong way round, but there are a couple more things that can be caught by the Chameleon.

#### Lines 1 to 2: Simple stuffEdit

By now, you would know that line 1 contains the data for the piece in question. Simple enough. The second line says that it may move and not capture (the m) any orthogonal or cardinal direction (255) for any direction (n). Nice and simple.

#### Lines 3 to 6: the Plus ChainEdit

The next four lines shows the Chameleon's capturing moves. As three of the pieces in Ultima are really heavily disguised cannons we can chain all of them together with the plus sign. If you use the plus sign just copy the code until the punctuation marks line up, like the example given.

Now, these lines say that the Chameleon, when moving like a rook (15[3]) can run any number of spaces (the first n), then jump across exactly 1 piece, and then comes back one square before landing. Then it captures the destination (the piece that it lands on), then moves one step back (/4) to complete the move. @ notation states that this is for enemy pincer pawns only.

The plus sign, placed here, means that c/cannon( should be pulled down to complete the chain. This time, it can travel for any distance in an arbitrary direction, until it passes through any number of enemies (n). It then travels for any number of squares it wishes before landing. It captures the screen(s) (the pieces it passes through.)

#### Lines 7 to 9: The RestEdit

The seventh line states that at two squares, where the x coordinate of itself and the y coordinate its friendly King, and the x coordinate of its friendly King and the y coordinate of itself, are where a rifle-capture of enemy Coordinators can happen.

The eighth line immobilizes any immobilizers that goes into the indicated range, and the ninth line allows it to capture a King if it is one square away from it.

That's all, so we close the largest bracket and go.

## NotesEdit

1. Although, usually, the E< is dropped, and the interpreter will add them in manually.
2. Just so as you know: the B stands for Boolean.
3. I give up the tt tags by now; replaced them with parentheses.