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 Sat, Feb 23, 2019 06:36 PM UTC:

The diagram is in the comments to the Xiangqi article: https://www.chessvariants.com/index/listcomments.php?id=33312 . From its page source:

        function BadZone(x, y, piece, color) { // enforce board zones
          if(touched) return 0; // not during ShowMoves()
          if(piece == 4) return (color ? y < 5 : y > 4); // Elephant: across river
          if(piece != 3 && piece != 8) return 0; // otherwise OK if not Advisor or King
          return x < 3 || x > 5 || (color ? y < 7 : y > 2) && (board[y][x] & 511) != 8;
        }
        function Shade(x, y) {
          var col = 0;
          if(y > 4) col = !col;
          if(x > 2 && x < 6 && (y < 3 || y > 6)) col= !col;
          return col;
        }

The argument 'piece' contains the type of the moved piece, and 'color' indicates its color (non-zero = 1024 = black). The routine is called for a proposed move, so board[y][x] at this point is still the victim. I suppose the exception made for allowing a King to leave his Palace to capture the other King is not really necessary when its move is defined as WfkR; King and Advisors could simply be allowed in either Palace, as they have no moves that would bring them to the opponent Palace other than the one that must capture a King.