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 Latest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Comments/Ratings for a Single Item

LatestLater Reverse Order EarlierEarliest
Game Courier Developer's Guide. Learn how to design and program Chess variants for Game Courier.[All Comments] [Add Comment or Rating]
Jean-Louis Cazaux wrote on Thu, Jan 13, 2022 08:36 PM UTC in reply to Aurelian Florea from 09:53 AM:

Hello Aurelian. I have no plan to use them. There are probably very special to put in a CV, but not without interest.


Aurelian Florea wrote on Thu, Jan 13, 2022 09:53 AM UTC in reply to Jean-Louis Cazaux from 09:31 AM:

Hello Jean-Louis, I am curious if you are interested by the horizontal counterparts of the two pieces for use in your variants.


Jean-Louis Cazaux wrote on Thu, Jan 13, 2022 09:31 AM UTC in reply to Daniel Zacharias from 01:23 AM:

Warm thanks to both of you. It seems to work fine for both pieces. That's great.


Daniel Zacharias wrote on Thu, Jan 13, 2022 01:23 AM UTC in reply to Bn Em from 01:07 AM:

That doesn't quite work, because leaps checks all four directions instead of just forwards and backwards. Maybe checkride shouldn't work either, but I tried it and it seems to.

This works for the Snake

def U fn (checkaride #0 #1 1 1 and empty #0)
    where #0 0 1
    #1
    or fn (checkaride #0 #1 -1 1 and empty #0)
    where #0 0 1
    #1
    or fn (checkaride #0 #1 1 1 and empty #0)
    where #0 0 1
    #1
    or fn (checkaride #0 #1 -1 -1 and empty #0)
    where #0 0 -1
    #1
    or fn (checkaride #0 #1 1 -1 and empty #0)
    where #0 0 -1
    #1
    or checkaleap #0 #1 0 1
    or checkaleap #0 #1 0 -1;

def UL mergeall
    ray where #0 0 1 1 1
    ray where #0 0 1 -1 1
    ray where #0 0 -1 -1 -1
    ray where #0 0 -1 1 -1
    where #0 0 1
    where #0 0 -1;

Bn Em wrote on Thu, Jan 13, 2022 01:07 AM UTC in reply to Daniel Zacharias from Wed Jan 12 11:03 PM:

I believe you want checkaride instead of checkride — the latter checks all directions symmetrically (making a full gryphon plus conditional wazir moves), while the former is asymmetric.

Presumably if your suggestion for the Ship is otherwise correct, the snaketongue would similarly be:

def G fn (checkaride #0 #1 1 1 and empty #0)
    where #0 0 1
    #1
    or fn (checkaride #0 #1 -1 1 and empty #0)
    where #0 0 1
    #1
    or fn (checkaride #0 #1 1 -1 and empty #0)
    where #0 0 -1
    #1
    or fn (checkaride #0 #1 -1 -1 and empty #0)
    where #0 0 -1
    #1
    or checkleap #0 #1 1 0;

def GL mergeall
    leaps #0 1 0
    ray where #0 0 1 1 1
    ray where #0 0 -1 1 -1
    ray where #0 0 1 -1 1
    ray where #0 0 -1 -1 -1;

Daniel Zacharias wrote on Wed, Jan 12, 2022 11:03 PM UTC in reply to Jean-Louis Cazaux from 09:48 PM:

I think this works for the ship, but I'm not quite sure how to do the Snake

def G fn (checkride #0 #1 0 1 and empty #0)
    where #0 1 1
    #1
    or fn (checkride #0 #1 0 1 and empty #0)
    where #0 -1 1
    #1
    or fn (checkride #0 #1 0 -1 and empty #0)
    where #0 1 -1
    #1
    or fn (checkride #0 #1 0 -1 and empty #0)
    where #0 -1 -1
    #1
    or checkleap #0 #1 1 1;

def GL mergeall
    leaps #0 1 1
    ray where #0 1 1 0 1
    ray where #0 1 -1 0 -1
    ray where #0 -1 1 0 1
    ray where #0 -1 -1 0 -1;

Jean-Louis Cazaux wrote on Wed, Jan 12, 2022 09:48 PM UTC:

I beg some help, this is above my skills. I do cut and try, but I'm unable to get it. I want to code a Ship (t(FvR), vertical Gryphon) and a Snake (t(vWB), vertical Manticore). I was thinking to go from Gryphon and Manticore. How should I modify those:

def G fn (checkride #0 #1 1 0 and empty #0) where #0 sign - file #1 file #0 sign - rank #1 rank #0 #1

and != file #1 file #0 and != rank #1 rank #0 or checkleap #0 #1 1 1;

def GL mergeall leaps #0 1 1 rays where #0 1 1 1 0 rays where #0 1 -1 1 0 rays where #0 -1 -1 1 0 rays where #0 -1 1 1 0;

and :

def U fn (checkride #0 #1 1 1 and empty #0) where #0 0 sign - rank #1 rank #0 #1

or fn (checkride #0 #1 1 1 and empty #0) where #0 sign - file #1 file #0 0 #1

or checkleap #0 #1 1 0;

def UL mergeall leaps #0 1 0 rays where #0 0 1 1 1 rays where #0 0 -1 1 1 rays where #0 1 0 1 1 rays where #0 -1 0 1 1;

Thanks!!!


Jean-Louis Cazaux wrote on Mon, Dec 20, 2021 05:33 PM UTC in reply to Greg Strong from 02:56 PM:

It is me who says you many thanks!


Greg Strong wrote on Mon, Dec 20, 2021 02:56 PM UTC in reply to Jean-Louis Cazaux from Thu Dec 16 10:18 PM:

These pieces have been added. Please let me know if you would like any adjustments.

Thanks, Greg


Greg Strong wrote on Fri, Dec 17, 2021 02:12 PM UTC in reply to Jean-Louis Cazaux from Thu Dec 16 10:18 PM:

Hi Jean-Louis,

I will take care of this this weekend.


Jean-Louis Cazaux wrote on Thu, Dec 16, 2021 10:18 PM UTC:

I use "Alfaerie for Metamachy" as a set for the GC presets of my CVs. Who could add 6 new pieces from Alfaerie , coded with 2 letters, to this set?

I would like to have added: the Snake (SN), the Ship (SH), the Bird (BI), the Tiger (TI), the Ram (RA), the Dragon (DR).

Thanks for the help.


A. M. DeWitt wrote on Fri, Oct 15, 2021 07:25 PM UTC:

As it turned out, I didn't need the suicides to perform the burns in Suzumu Shogi. I just needed to tweak the isdoublemove subroutine a little bit, add a FD subroutine for the Fire Demon, tweak the Fire Demon functions to include the new subroutine, and return the Fire Demon to its destination square with empty and add after it made a burning move. I love GAME code... :)


🕸📝Fergus Duniho wrote on Thu, Oct 14, 2021 12:22 PM UTC in reply to A. M. DeWitt from 04:06 AM:

If something similar could be used to detect the type of piece affected by the suicide, that should be everything I need to enforce the burning rules using suicides, at least in theory.

That information is in #pfore. Just use the coordinates of the spaces with missing pieces as keys to this array.


A. M. DeWitt wrote on Thu, Oct 14, 2021 04:06 AM UTC in reply to Fergus Duniho from Sun Oct 10 11:15 PM:

This preset of yours for detecting captures is huge. The fact that it reliably detects where the suicide occured means that I can use it to test whether the suicide is a King's move away from the moving Fire Demon and ensure that no suicides are done when a non-Fire Demon moves, which should solve the majority of problems with coding the burning move. If something similar could be used to detect the type of piece affected by the suicide, that should be everything I need to enforce the burning rules using suicides, at least in theory. Best of all, I can just ask players that haven't made a burn after moving a Fire Demon rather than worry about displaying legal moves on the board.

You could adapt it. For the multi-move variants, there are usually the same number of move parts each turn. So, it makes sense for these games to do the multi-part analysis globally for all pieces. But for games that include pieces with multi-part moves, you may want to reserve the multi-part analysis for specific pieces and tailor it to each piece that needs it.

This is what the original Suzumu Shogi preset (and all presets using the same general codebase) does, which is largely thanks to its isdoublemove subroutine. So, I guess I could use integers instead of booleans and sub ismultimove instead of sub isdoublemove to keep track of which part of the move suffices. The only major problem is that I'm not exactly sure how to enforce rules for the third part of a three-part move. Perhaps I am overthinking it though. Perhaps just copy-pasting and tweaking the code for the second part of multi-moves will be enough. This requires testing, but thankfully, the Taishin Shogi preset (which is fully coded, at least for enforcing the old rules) affords just such an opportunity.

Edit: I figured out how to detect the type of piece that committed the suicide. Now we should be all good.


🕸📝Fergus Duniho wrote on Mon, Oct 11, 2021 06:48 PM UTC:

I realized the role that $width and $height play in centering the borders for highlighting spaces, and with that in mind, I simplified the code in draw_grid_png.php and made adjustments to the $width and $height of Shogi pieces and to the values of $offx and $offy in image_dimensions.php. By using proper values for $width and $height, the code will always apply CSS for margins and padding to the space class rather than to each element of the space class.

I didn't immediately recognize the importance of $width and $height, because I created these variables years before I ever added the ability to display legal moves by highlighting spaces. These variables describe the width and height of spaces, and they are used when automatically generating a board to know what dimensions to give to spaces. But sometimes an image of a board is used instead, and when it is used, $width and $height should match the size of the spaces on the image.

This is what I was neglecting to do. The highlighting in Shogi was a bit off, because the value of $height did not match the height of the spaces on the images of Shogi boards.

Since Shogi divides each space by lines, there are two choices on how to specify the dimensions of a space. One is to use the inner space between the lines, and the other is to extend the size to include the lines. I tried both and chose the latter for Shogi.

For automatically-generated boards, the centering of borders for highlighting should now be done automatically. But for boards provided as pre-drawn images, it's important to match them up with the correct values for $width and $height. One way would be to size the board with spaces the same size as the dimensions given for the piece sets to be used with it. Abstract and Alfaerie sets both normally use 50x50 spaces. Another way would be to provide correct values for your board. I could add these to the image_dimensions.php script for specific boards.


🕸📝Fergus Duniho wrote on Sun, Oct 10, 2021 11:15 PM UTC in reply to A. M. DeWitt from Sat Oct 9 01:23 AM:

Another possibility for detecting a suicide move is to store the board position before the move into a variable, then compare the new position after the move to the stored position and see what differences there are.

This could potentially solve the problems of detecting a suicide move if I knew how to do it.

Here's a preset I made to demonstrate how to do this:

https://www.chessvariants.com/play/pbm/play.php?game%3DChess%26settings%3Dspotcaptures

This records the position of every piece on the board in an array whose keys are coordinates and whose values are piece labels. It does this both before and after a move. It then goes through the current positions of pieces. For each empty space, represented with the @ piece, it compares it with the previous value to see if it was empty before. If it wasn't empty before, it records it as a capture.

Since I am already writing this, would the system used for the multi-move variants be able to handle moves with three or more parts (i.e. that of the Lion Dog in Maka Dai Dai Shogi)?

You could adapt it. For the multi-move variants, there are usually the same number of move parts each turn. So, it makes sense for these games to do the multi-part analysis globally for all pieces. But for games that include pieces with multi-part moves, you may want to reserve the multi-part analysis for specific pieces and tailor it to each piece that needs it.


A. M. DeWitt wrote on Sat, Oct 9, 2021 01:23 AM UTC in reply to Fergus Duniho from Wed Oct 6 04:52 PM:

Since it sounds like your Fire Demon piece is making a multi-part move, you may want to break down the whole move and analyze it step-by-step. You will find examples of this in multi-move variants like Marseillais Chess and Extra Move Chess.

Hmm. Perhaps the step-by-step approach would be better. After all, the Suzumu Shogi preset is essentially on a more restrictive form of the other multi-move presets with more pieces.

So the tentative process would then be the folowing

Do a regular move

  • Normal move
  • Normal capture
  • King step (capture)
  • King step (non-capture), pass (double move)
  • Single King step (non-capture), return to origin square (double move)

Then I would need to assess whether or not there are pieces available to burn (which should be easy thanks to the burn subroutine in my Tenjiku Shogi preset). If so, after the move, do an igui capture or pass.

Or it may be simpler to simply always give the player to optionally shoot any enemy piece a King step away after moving.

Another possibility for detecting a suicide move is to store the board position before the move into a variable, then compare the new position after the move to the stored position and see what differences there are.

This could potentially solve the problems of detecting a suicide move if I knew how to do it.

Since I am already writing this, would the system used for the multi-move variants be able to handle moves with three or more parts (i.e. that of the Lion Dog in Maka Dai Dai Shogi)? This will be important for my larger games with Lion Dogs, Furious Fiends, Kirin Masters, and Phoenix Masters, as well as if I use the move breakdown method for the Fire Demon's burns.


🕸📝Fergus Duniho wrote on Wed, Oct 6, 2021 04:52 PM UTC in reply to A. M. DeWitt from 02:17 PM:

Is there a way to detect suicide moves in GAME code?

There are two ways of doing a suicide, and these have different effects on the $old variable. Adding an @ to a space works like a promotion, which leaves the value of $old unaffected. Moving a piece nowhere gives $old an empty value. This may give a better indication that the move included a suicide, but it would come at the expense of the information about where the piece moved to.

Since it sounds like your Fire Demon piece is making a multi-part move, you may want to break down the whole move and analyze it step-by-step. You will find examples of this in multi-move variants like Marseillais Chess and Extra Move Chess.

With that in mind, another option would be to move the Fire Demon to the piece's space, then immediately move it back.

Another possibility for detecting a suicide move is to store the board position before the move into a variable, then compare the new position after the move to the stored position and see what differences there are.


🕸📝Fergus Duniho wrote on Mon, Aug 9, 2021 04:58 PM UTC:

Contrary to what was documented, the rlink command was not available. Maybe I accidentally used Ctrl-z too many times. So, I added it back in. I also fixed a bug in link that stopped it from working after the first pair.

I expanded the power of the map command. It was previously useful only for creating logical directions from leaps defined in terms of ranks and files. This limited it to the directions available on a simple grid. To make it easier to create directions for boards with unusual geometries, it can now be used with previously created logical directions. In the Cylindrical Chess preset I'm working on, I used link and rlink to add connections between the a and h files for east and west, and then I used map to define the diagonal and hippogonal directions without handwriting them link by link. The code looks like this:

map n 0 1 s 0 -1 w -1 0 e 1 0; // Orthogonal directions
link w (a1 h1) (a2 h2) (a3 h3) (a4 h4) (a5 h5) (a6 h6) (a7 h7) (a8 h8);
rlink e (a1 h1) (a2 h2) (a3 h3) (a4 h4) (a5 h5) (a6 h6) (a7 h7) (a8 h8);
map nw (n w) ne (n e) sw (s w) se (s e);
map nne (n ne) nnw (n nw) sse (s se) ssw (s sw);
map nee (ne e) nww (nw w) sww (sw w) see (se e);

🕸📝Fergus Duniho wrote on Thu, May 6, 2021 11:53 PM UTC in reply to Fergus Duniho from Tue Feb 16 10:02 PM:

I have added the ability to use entirely custom piece sets in a game. These are defined in GAME Code and do not use an external PHP file. Here is some sample code I wrote:

// A demo of using multiple internal sets that do not match any set file.

// Name the sets you will use by assigning them to the $groupsets array.
// Use capitalized names for the sets. These do not match any file names.
setsystem groupsets array Abstract Alfaerie AlfaeriePNG Magnetic Motif;

// Define pieces in an array variable called mypieces.
// Start by creating an associative array of all pieces shared in common.
// The key should be a label, and the value should be a filename.
// A single line of code is broken into multiple lines of text for legibility.
set mypieces assoc 
  K "WKing.gif"   k "BKing.gif" 
  Q "WQueen.gif"  q "BQueen.gif" 
  R "WRook.gif"   r "BRook.gif" 
  B "WBishop.gif" b "BBishop.gif" 
  N "WKnight.gif" n "BKnight.gif" 
  P "WPawn.gif"   p "BPawn.gif";

// Set the $dir system variable to match the set, and modify filenames as needed.
if == pieceset Alfaerie:
  setsystem dir "/graphics.dir/alfaerie/";
  foreach (k v) #mypieces:
    setelem mypieces #k tolower #v;
  next;
elseif == pieceset AlfaeriePNG:
  setsystem dir "/graphics.dir/alfaeriePNG/";
  foreach (k v) #mypieces:
    setelem mypieces #k tolower str_replace .gif .png #v;
  next;
elseif == pieceset Magnetic:
  setsystem dir "/graphics.dir/magnetic/";
elseif == pieceset Motif:
  setsystem dir "/graphics.dir/motif/";
else:
  // Have a default set for when the set does not match any allowed set.
  // The default is Abstract.
  setsystem dir "/graphics.dir/abstract/";
endif;

// Now that the pieces are defined, copy the #mypieces array to $pieces
setsystem pieces #mypieces;

Aurelian Florea wrote on Sun, Apr 25, 2021 06:19 AM UTC in reply to Jean-Louis Cazaux from Sat Apr 24 10:59 AM:

Jean-Louis, You can use any string enclosed in brackets. Hopefully this will help you.


🕸📝Fergus Duniho wrote on Sun, Apr 25, 2021 02:00 AM UTC in reply to Jean-Louis Cazaux from Sat Apr 24 10:59 AM:

You can use any string, not just individual letters. I recommend sticking to short strings of the 26 letters identified in ASCII, so that players have an easier time typing notation.


Jean-Louis Cazaux wrote on Sat, Apr 24, 2021 10:59 AM UTC:

I apologise if my question is trivial, all this looks very complex for me. I want to use a set "Alfaerie for Metamachy" but for the moment it is limited to 26 pieces, using the 26 letters of the alphabet. Would it be possible to add few more using other letters such as the diacritic letters may be like é/É? Thanks


🕸📝Fergus Duniho wrote on Wed, Feb 17, 2021 09:20 PM UTC:

How to replace piece labels without using aliases

The Alfaerie:Many set uses many cryptic labels that include punctuation, and it would be best to avoid using these to represent your pieces in games. In the past, you could set aliases to avoid using these labels, but you would also have to meticulously make sure you used the aliases rather than the labels. Instead of doing this, you may now completely replace the original labels with new ones. Here is how to do it. This code has all been tested and saved to an example preset.

  1. Use the labels defined in Alfaerie:Many in your FEN code while designing the board. In my example, I used {.df}n{b$}qk{b$}n{.df}pppppppp32PPPPPPPP{.DF}N{B$}QK{B$}N{.DF}.

  2. Create two arrays, one for regular pieces, and one for flipped pieces. Depending on the set file, you may not need one for flipped pieces, but Alfaerie:Many does include some flipped pieces. So, you have to include it for this set.

set mypieces ();
set myflipped ();
  1. For the pieces that will remain unchanged, simply add them to these arrays like so:
foreach label (k K q Q n N p P):
  setelem mypieces #label pieceimg #label;
  setelem myflipped #label flipimg #label;
next;
  1. For pieces that will be relabled, assign the appropriate images to your new labels. These use the pieceimg and flipimg operators to return the images for regular and flipped pieces. It then replaces the old pieces on the board with the new ones that have more appropriate labels. It uses an array of all spaces for this task.
set sp spaces;
foreach pair ((.df r) (.DF R) (b$ b) (B$ B)):
  setelem mypieces #pair.1 pieceimg #pair.0;
  setelem myflipped #pair.1 flipimg #pair.0;
  replace #pair.0 #pair.1 all #sp;
next;
  1. Reassign values to both $pieces and $flipped:
setsystem pieces #mypieces;
setsystem flipped #myflipped;
  1. Update the value of $originalpieces:
setsystem originalpieces currentpieces;

🕸📝Fergus Duniho wrote on Tue, Feb 16, 2021 10:02 PM UTC:

I have added the pieces system variable. This is the array stored in a set file. Its keys are piece labels, and its values are the filenames of image files. It basically tells which graphics to use for the pieces. I also fixed things so that you can set or get specific values of this array. This is done by following the variable name with a period and the element name. Because this will not work for labels that include periods, I have also added the pieceimg operator. This returns a specific element of the $pieces array.

The point of this is to make it even easier to support multiple sets when matching sets have not been provided. It can also be used to eliminate the need to use aliases. Here is how it may be used:

  1. Set groupsets to an array of the allowed sets. Each should be the basename of a set file:
setsystem groupsets array abstract5 alfaerie-many;
  1. Create an empty array:
set mypieces ();
  1. For any pieces whose images already have the same label in different sets, set the corresponding elements of your array to those pieces:
set mypieces.k $pieces.k;
set mypieces.K $pieces.K;
set mypieces.q $pieces.q;
set mypieces.Q $pieces.Q;
set mypieces.r $pieces.r;
set mypieces.R $pieces.R;
set mypieces.b $pieces.b;
set mypieces.B $pieces.B;
set mypieces.n $pieces.n;
set mypieces.N $pieces.N;
set mypieces.p $pieces.p;
set mypieces.P $pieces.P;

Or just:

foreach label (k K q Q r R b B n N p P):
  setelem mypieces #label pieceimg #label;
next;
  1. For each allowed set, use an if-elseif-else block or a switch-case block to set an individualized value for any pieces that are different between sets:
if == pieceset abstract5:
  set mypieces.s $pieces.s;
  set mypieces.S $pieces.S;
elseif == pieceset alfaerie-many:
  set mypieces.s pieceimg .de;
  set mypieces.S pieceimg .DE;
endif;
  1. Change the value of $pieces to that of the array you created:
setsystem pieces #mypieces;

Although you could have edited $pieces directly, this has the advantage of stripping $pieces of all the pieces you will not be using in your game.


25 comments displayed

LatestLater Reverse Order EarlierEarliest

Permalink to the exact comments currently displayed.