Check out Alice Chess, our featured variant for June, 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

About Game Courier. Web-based system for playing many different variants by email or in real-time.[All Comments] [Add Comment or Rating]
🕸💡📝Fergus Duniho wrote on Fri, Jun 7 04:13 PM UTC in reply to Jean-Louis Cazaux from Fri May 31 05:15 AM:

I would have the piece figuring among the captured ones only when it has been captured, either in its original or its promoted form.

While it doesn't make a huge difference in Chess or most Chess variants, I am now working on a hidden information variant in which I would like to hide what piece a Pawn promoted to, and the default way of showing captured pieces could reveal what the promoted piece is by pulling it from the captured pieces. So I thought back to this suggestion and came up with a way to implement it.

In the Pre-Game section, I have this code to setup an associative array of all capturable pieces with none captured yet. Note that the order here affects the order that captured pieces will be displayed in, and the specific pieces chosen are for the particular variant. I use the cp array to make it easier to adjust specific elements of the array, then I pass its value to $capturedpieces.

set cp assoc Q 0 q 0 M 0 m 0 A 0 a 0 R 0 r 0 B 0 b 0 N 0 n 0 P 0 p 0;
setsystem capturedpieces var cp;

In each Post-Move section, I have this code for adding each actually captured piece to the associative array cp, then copying it to $capturedpieces.

if != $old @:
  set cp.{$old} + 1 elem $old cp;
  setsystem capturedpieces var cp;
endif;

It's important to keep $capturedpieces up to date, so that the correct value is used when looking at past moves. This is why it gets set immediately after setting or updating cp.