Check out Grant Acedrex, our featured variant for April, 2024.


[ Help | Earliest Comments | Latest Comments ]
[ List All Subjects of Discussion | Create New Subject of Discussion ]
[ List Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Single Comment

Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Wed, Dec 29, 2021 10:00 PM UTC in reply to Aurelian Florea from 08:43 AM:

Well, actually it doesn't, because I messed up. One should not test pieceType (which will always be 14 at this point), but imi, to decide which moves to forbid. In addition, I tested for a full square, rather than an empty. The following routine should work: it first declares OK all non-imitator moves, all imitations of non-pawns, and all moves to occupied squares. At that point only non-capture pawn imitations are left, and advances of more than 1 rank can be flagged as illegal. finally it tests for e.p. depending on which pawn type is imitated.

    function BadZone(toFile, toRank, pieceType, color, fromFile, fromRank) {
      if(pieceType != 14) return 0;
      if((imi & 511) > 2) return 0;
      if(board[toRank][toFile] & 511) return 0;
      if(fromRank > toRank + 1 || fromRank < toRank - 1) return 1; 
      if(imi == 1) return (toFile != fromFile);
      return (toFile == fromFile);
    }