The Chess Variant Pages
Custom Search

[ 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

This item is a reference work
It belongs to categories: Orthodox chess, 
It was last modified on: 2015-11-06
 By H. G.  Muller. Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
Adam DeWitt wrote on 2019-02-23 UTC

The BadZone function is indeed very useful. For example, if you wanted forbidden moves of royal pieces into check (which are highlighted dark gray) to not show up at all, all you need to do is use this function in your script, which works with both moves that move directly into check and castling moves that land on or pass through check:

function BadZone() { return blockFlag; }

However, this function isn't elaborated on very well. It has four parameters - x, y, piece, and color. The parameters x and y can be used to track the destination square of a piece (i.e. typ = board[y][x]) but piece and color are shrouded in mystery.

You said that you used this function to "confine pieces to their zones in Xiangqi," which is very interesting and could be very useful, as I am reasonably certain that you all four parameters there, though I could be wrong. Perhaps you can show me the function that you wrote to do this?