Nomenclature suggestion: Bit target programs

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Re: Nomenclature suggestion: Bit target programs

Post by sje »

AlvaroBegue wrote:In the code for Ruy-López we use the word "piece" as including pawns and kings and the word "officer" to describe a piece that is not a pawn or a king. Well, it's actually in Spanish, but "pieza" and "oficial" are analogous.
In English, as you likely already know, pieces are divided into major pieces (queen, rook) and minor pieces (bishop, knight). I've seen a couple of references to royals, being kings and queens. In the field of heterodox chess, a royal is any chessman which can be checked and must respond accordingly. In Oscar, the use of peon to refer to any non-king chessman is my own invention.

A stepper is a king, knight, or pawn. A sweeper is a queen, rook, or bishop. These and some of the other terms I use come from a time more than forty years ago back before I'd seen much of any topical literature or program sources.

In my chess software source, a piece is a color-less chessman, somewhat like a color being a piece-less chessman. A man has both color and piece attributes combined in a single integer value.

I'm not interested in inventing a new term for something which already has an accepted name. However, I'm not going to use an inconsistent name inside my software. So while I accept that pieceset is the best of the existing names, my source will use TargetSet (upgraded from TiBV).

Extending this treatment, should I ever write another chess program, instead of using the term bitboard, I'll use SquareSet.
User avatar
stegemma
Posts: 859
Joined: Mon Aug 10, 2009 10:05 pm
Location: Italy
Full name: Stefano Gemma

Re: Nomenclature suggestion: Bit target programs

Post by stegemma »

Why not "mixboard?
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Nomenclature suggestion: Bit target programs

Post by hgm »

sje wrote:A stepper is a king, knight, or pawn. A sweeper is a queen, rook, or bishop. These and some of the other terms I use come from a time more than forty years ago back before I'd seen much of any topical literature or program sources.
More standard nowadays is to call Q, R, B sliders. And the term stepper is usually reserved for pieces that only move to adjacent squares (so King and Pawn), while the more general term that also applies to the Knight is leaper. So a stepper is a range-one leaper.

Similarly, the more general term for a piece that repeats its basic stride until it hits something is rider. A slider is a special case of a rider where the underlying stride is of range one. The piece that repeats the Knight step (Nightrider) is thus not considered a slider.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Sets

Post by sje »

For internal names in Oscar and in any future software, I'll use TargtetSet and SquareSet. The use of the word set comes from the set type definition capability in Pascal. For any set, an element, selected by an ordinal, is either present or absent.

The term TargetSet is used instead of ManSet because there are only 12 different chessmen while a board may have up to 32 different targets.

Long ago, I wrote a Qubic (4x4x4 tic-tac-toe) program which used 64-bit cell sets and also 76-bit win sets. For the latter, each element corresponded to one of the 76 distinct possible four-in-a-row wins. The program was both fast and strong, beatable only by a copy of itself running at a greater search depth. Well, at the time; since then the game has been proven a win for the first player in two player mode.

--------

I like stepper and sweeper because they are descriptive and both have the same number of letters.
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Nomenclature suggestion: Bit target programs

Post by Evert »

Once upon a time I called chess men pieces, I called B and N light and R and Q heavy pieces or officers. Anything non-royal was wood. I think all of these are imprecise translations from Dutch to English.

These days I distinguish pawn class pieces (pieces that can promote and only make irreversible moves), minor pieces (any piece that isn't a pawn but doesn't have mate potential), major pieces (pieces that have mate potential and have similar strength to a rook) and super pieces, which are even stronger (the Q is the only super piece in orthochess). The idea behind the distinction between a major piece and a super piece is that a major piece draws against a minor piece while a super piece normally wins against minors or a single major piece (but I don't actually implement the distinction this way). Other piece categories I use are royal (anything that must respond to check, or loses the game if lost) and defensive (pieces that are restricted to the home side of the board). SjaakII's evaluation terms are based on these different piece categories (an issue I haven't fixed is that it actually mis-identifies the Shogi Lance as a major piece).
User avatar
hgm
Posts: 27808
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Nomenclature suggestion: Bit target programs

Post by hgm »

I found thge distinction light (B,N-class) and heavy (R-class or stronger) more fundamental than the minor/major distinction based on mating potential. There are plenty of pieces not stronger than Knight which do have mating potential (the Shogi Gold General being one of the weakest, with only 6 target squares). But this seems to contribute very little to their vaue. OTOH pieces can easily be stronger than Rook, and not have mating potential (e.g. Nightrider).

'Super-piece' is a bit ill-defined. Capablanca Archbishop and Chancellor should clearly count as such, as they differ less than a Pawn in value from a Queen. But they cannot generally beat Rook (although for KCKR it can in about half the cases). A Queen does not even beat a Commoner (non-royal King), once it connects with its King, while the Commoner should count as a light piece. (Even in the end-game it is only marginally stronger than Knight.) There are even pieces with value close to 8 that have no mating potential (e.g. the Aanca, which moves one step orthogonal, and then continues like a Bishop). I guess a piece that could teleport to all squares of the color it is on would be far stronger than a Queen, but as it is color bound, it has no mating potential. (And teleporting to opposite colored squares even guarantees you a draw at any time by perpetual checking...)
User avatar
Evert
Posts: 2929
Joined: Sat Jan 22, 2011 12:42 am
Location: NL

Re: Nomenclature suggestion: Bit target programs

Post by Evert »

hgm wrote:I found thge distinction light (B,N-class) and heavy (R-class or stronger) more fundamental than the minor/major distinction based on mating potential. There are plenty of pieces not stronger than Knight which do have mating potential (the Shogi Gold General being one of the weakest, with only 6 target squares). But this seems to contribute very little to their vaue. OTOH pieces can easily be stronger than Rook, and not have mating potential (e.g. Nightrider).
I had a quick look at the code to remind myself how these are actually handled in the code.

In the classification code, a minor is any piece that doesn't have mate potential. A super piece is a major piece that is stronger than a rook. The "strength" is measured by the sum of the attack pattern on a 3x3 and 5x5 board, adjusted for whether the piece attacks any squares at all on the 3x3 board (a knight doesn't, if placed at the centre) and whether the piece is colour-bound or not. The idea behind this is that this is a measure of how dangerous an enemy piece is if it is close to your king.

This attack-score is what is actually used when evaluating king safety or game-phase. I mis-remembered how the evaluation scaling is handled (perhaps it's something I planned to do but didn't get round to doing). The score is adjusted for the presence of mate potential on either side and the number of surplus pieces, independent of their classification. This may cause Sjaak to unfairly penalise KQKM in the same way it would KRKM, but I don't think this will actually change the outcome of the game. It will just prefer to not exchange surplus material until winning the minor comes within the horizon.

Of course piece values are input, so the user is free to set these in a way that breaks things horribly. Sadly, I don't believe any of the clever algorithms people have published to estimate piece value from the rules alone.
'Super-piece' is a bit ill-defined. Capablanca Archbishop and Chancellor should clearly count as such, as they differ less than a Pawn in value from a Queen. But they cannot generally beat Rook (although for KCKR it can in about half the cases).
Well, as I said, the distinction is a bit arbitrary, and more based on how dangerous the piece is in a king attack than how it performs in the end game. As it is, KQKR, KCKR and KAKR would all be classified as pawn-less, single piece with mate potential on either side and penalised (scaled) accordingly.
A Queen does not even beat a Commoner (non-royal King), once it connects with its King, while the Commoner should count as a light piece. (Even in the end-game it is only marginally stronger than Knight.)
True, but knowing that requires some fairly specific knowledge (which could be implemented in a general way: a King cannot attack a Commoner and a Commoner can retain the protection of the King when either of them moves. The first means you can't do a double-attack on it and the latter means that you cannot break the connection once it is established). As it is, KQKC (or KQKK in Spartan) would get the same penalty as KQKR or KAKR (since the Commoner has mate potential).

However, the attack rating of the Commoner is indeed the same as for a Knight or Bishop so in evaluation terms that are based on this it would be weighed as a minor piece.
There are even pieces with value close to 8 that have no mating potential (e.g. the Aanca, which moves one step orthogonal, and then continues like a Bishop). I guess a piece that could teleport to all squares of the color it is on would be far stronger than a Queen, but as it is color bound, it has no mating potential. (And teleporting to opposite colored squares even guarantees you a draw at any time by perpetual checking...)
Sure, rules of thumb can only help you so much in the end. The trick is to get them to help you as much as possible, while preventing them from messing up in situations where they don't apply.

This is why I test "mate potential" explicitly when deciding whether to scale or not and "attack strength" when the actual power of the piece is in question and "piece value" when assessing material balance.

Typically, pieces with a high "attack strength" have a high piece value but there is (obviously) no strict correspondence: the Spartan General (Dragon King), the Archbishop and the Chancellor all have the same "attack strength" but they don't have the same piece value. An even better case are the promoted pieces in Shogi: most have the same "strength" as a Gold, but they don't have the same value. I tend to use "attack strength" when I prefer an "objective" (as in, not a number that the user specifies) guestimate for the value of a piece and the exact nuances are less important.