Check out Glinski's Hexagonal Chess, our featured variant for May, 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 Mon, Dec 27, 2021 01:45 PM UTC in reply to Aurelian Florea from 04:17 AM:

Well, the idea was not to change any piece types, but detect whether the generated move was for an imitator imitating a pawn, and in that case forbid the move (by returning a non-zero value) when it advanced more than one rank. This was not so easy, though, because BadZone did not get the coordinates of the origin square passed to it, and it was not obvious what the imitator was imitating.

I did change the Diagram script now to make this easier: the variable 'imi' now contains the imitated piece at all times during the game, not just when the AI is thinking. And the square of origin are passed as extra parameters to BadZone. (Refresh the browser cache!) This should make the following script so what you want:

<script>
function BadZone(toFile, toRank, pieceType, color, fromFile, fromRank) {
  if(pieceType != NUMBER_OF_JOKER) return 0;
  if(imi != NUMBER_OF_PAWN) return 0;
  return (fromRank != (color ? toRank + 1 : toRank - 1));
}
</script>

(Replace the NUMBER_OF_... by the actual numbers your pieces have in your table.)