bob wrote:Chess players usually call this an "absolute pin" which means "pinned on king so that it can't move out of the way."
You're right, of course.
But I wanted a structure component identifier which had the same number of letters as "pinned" and which meant "immovable". The word "frozen" won out over "jammed". This is all true.
This all came about in my first bitboard program long ago. There was a third btiboard of men which were pinned but not frozen; these men were called "restricted". This term lives in
Oscar in the form of "resdir" (restriction direction) and resbidir" (restricted bidirection). "Bidirection" is a neologism of my own:
Code: Select all
// Chessboard square-to-square direction: 4 orthogonal, 4 diagonal, 8 crooked (White POV)
typedef enum
{
DirNil = -1,
DirE, DirN, DirW, DirS, // Orthogonal
DirNE, DirNW, DirSW, DirSE, // Diagonal
DirENE, DirNNE, DirNNW, DirWNW, // Crooked (1st half)
DirWSW, DirSSW, DirSSE, DirESE // Crooked (2nd half)
} Dir;
#define DirLen (DirESE + 1)
#define DirOrtho0 DirE
#define DirOrtho1 DirS
#define DirOrthoLen (((si) DirS ) - ((si) DirE ) + 1)
#define DirDiago0 DirNE
#define DirDiago1 DirSE
#define DirDiagoLen (((si) DirSE ) - ((si) DirNE ) + 1)
#define DirSweep0 DirE
#define DirSweep1 DirSE
#define DirSweepLen (((si) DirSE ) - ((si) DirE ) + 1)
#define DirCrook0 DirENE
#define DirCrook1 DirESE
#define DirCrookLen (((si) DirESE) - ((si) DirENE) + 1)
#define IsDirNil(dir) ((dir) < 0)
#define IsDirNotNil(dir) ((dir) >= 0)
#define IsDirOrtho(dir) (0x000f & BX(dir))
#define IsDirDiago(dir) (0x00f0 & BX(dir))
#define IsDirSweep(dir) (0x00ff & BX(dir))
#define IsDirCrook(dir) (0xff00 & BX(dir))
#define IsDirPawnFreezeWhite(dir) (0x00c5 & BX(dir))
#define IsDirPawnFreezeBlack(dir) (0x0035 & BX(dir))
// Chessboard square-to-square bidirection
typedef enum
{
BidirNil = -1,
BidirE, // East <-> West
BidirN, // North <-> South
BidirNE, // Northeast <-> Southwest
BidirNW // Northwest <-> Southeast
} Bidir;
#define BidirLen (BidirNW + 1)
#define IsBidirNil(bidir) (bidir < 0)
#define IsBidirNotNil(bidir) (bidir >= 0)
#define IsBidirOrtho(bidir) (0x0003 & BX(bidir))
#define IsBidirDiago(bidir) (0x000c & BX(bidir))
Code: Select all
static const Bidir CvDirToBidir[DirSweepLen] =
{
BidirE, BidirN, BidirE, BidirN, BidirNE, BidirNW, BidirNE, BidirNW
};
Somewhat wordy, but it makes the legal-only generator code quick and easy to read.