From 8cb6a88dc7d6bac96ec8c1ad29b5c0dacd896d52 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sat, 3 Jan 2026 22:11:24 +0100 Subject: [PATCH] Let Betza parser understand true riding Riding moves like DD or AA were accepted by the Betza parser, but did not work because no magics for those moves were available. By using custom rides derived from the R and B masks then now do work: their basic leap is reduced to a single step, but the squares they are supposed to skip are then masked out of their magics mask and their pseudoAttacks. This allows specification of moves that ride along Queen rays with stride 2 or 3. (So AA, DD, HH and GG.) Lame versions of these (e.g. nDD) are also available: these would only mask the squares to be skipped out of the pseudoAttacks, and use those with ordinary Rook and Bishop magics which can still be blocked on those squares. --- src/piece.cpp | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/piece.cpp b/src/piece.cpp index f6ad675..82a4117 100644 --- a/src/piece.cpp +++ b/src/piece.cpp @@ -141,6 +141,15 @@ namespace { int y = atom.first + 3*fExtension + 2*fsExtension; int x = atom.second + 2*fsExtension; std::vector directions = {}; + if(rider && y > 1 && (x == 0 || x == y)) { // radial true rider + for(int n = distance; ~n & 1; n >>= 1) distance <<= y - 1; // adapt range to larger stride + distance &= 0xFFFF; + if(y == 2) distance |= 0x55555555; else + if(y == 3) distance |= 0xB6DBB6DB; else + if(y == 4) distance |= 0x77777777; + if(lame) distance &= 0xFFFF; + x /= y; y = 1; // use (masked) slider magics + } // Split directions for orthogonal pieces // This is required e.g. to correctly interpret fsW for soldiers for (auto s : prelimDirections) -- 1.7.0.4