Check out Symmetric Chess, our featured variant for March, 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 ]

Ratings & Comments

EarliestEarlier Reverse Order LaterLatest
The birth of 3 new variants - part 2 : Grand Apothecary Chess Modern[Subject Thread] [Add Response]
Aurelian Florea wrote on Thu, Jul 8, 2021 08:28 AM UTC:

@Fergus, Now I am trying to make the castling work.

The king is supposed to be able to castle with a rook by moving 3 spaces towards it or with a cannon by moving 4 spaces towards it, Usual conditions apply. I have used the following flags and variables:

set wcastle d1 c1 j1 k1; set bcastle d12 c12 j12 k12; setflag a1 b1 k1 l1; setflag a12 b12 k12 l12;

I have 2 problems. 1.The castling moves are not shown although they work. 2. The long cannon castle is not done entirely although the king moves correctly.


🕸Fergus Duniho wrote on Thu, Jul 8, 2021 11:49 AM UTC in reply to Aurelian Florea from 08:28 AM:

Can you give me a link to the preset you're working on?


🕸Fergus Duniho wrote on Thu, Jul 8, 2021 12:18 PM UTC in reply to Aurelian Florea from 08:28 AM:

set wcastle d1 c1 j1 k1; set bcastle d12 c12 j12 k12;

From these, I gather that the King lies somewhere between d and j.

setflag a1 b1 k1 l1; setflag a12 b12 k12 l12;

But here, nothing is flagged between d and j. Make sure to flag every single piece that can castle, including the King.


Aurelian Florea wrote on Thu, Jul 8, 2021 01:20 PM UTC in reply to Fergus Duniho from 12:18 PM:

I have repeated all my tests. The same two problems appear.


🕸Fergus Duniho wrote on Thu, Jul 8, 2021 02:03 PM UTC in reply to Aurelian Florea from 08:28 AM:

Test. I keep getting the error message, "There is no comment to post."


🕸Fergus Duniho wrote on Thu, Jul 8, 2021 04:32 PM UTC in reply to Aurelian Florea from 08:28 AM:
  1. The long cannon castle is not done entirely although the king moves correctly.

You don't seem to be unflagging spaces properly. I confirmed that you left the Rook's space unflagged by moving the Rook back after moving it and then castling with it. When the Rook's space remains flagged, you will not be able to castle with the Cannon. You should do as I do in Chess, which is to unflag every space moved to or from. The code used in Chess is

unsetflag $origin $dest;

🕸Fergus Duniho wrote on Thu, Jul 8, 2021 08:36 PM UTC in reply to Aurelian Florea from 08:28 AM:

I think I accidentally deleted a comment while deleting some test comments.

1.The castling moves are not shown although they work.

The code for this goes in the stalemated subroutine, and here is what you have in that subroutine:

// Castling code removed, since Apothecary Chess does not include castling.

So you need to add some code for it there. You can probably borrow some from the one in the fairychess include file. I'm not sure if it will require any modification. Try it without modification first and see how it works.


Aurelian Florea wrote on Mon, Jul 12, 2021 08:28 AM UTC in reply to Fergus Duniho from Thu Jul 8 08:36 PM:

@Fergus,

Why in the castle subroutine in fairychess.txt include file the line unsetflag #RPOS; is commented?


🕸Fergus Duniho wrote on Mon, Jul 12, 2021 05:44 PM UTC in reply to Aurelian Florea from 08:28 AM:

Why in the castle subroutine in fairychess.txt include file the line unsetflag #RPOS; is commented?

I suppose it could be uncommented if you wanted to be thorough, but it isn't necessary to prevent illegal castling. Once the King has moved, the space it moves from and the space it moves to both get unflagged, and every space the King moves to gets unflagged. So, no matter what, the King is still unable to castle. As long as the King can't castle, nothing can castle with the King. So, leaving a flag on the Rook's original space doesn't change anything critical to the game.


Aurelian Florea wrote on Tue, Jul 13, 2021 11:51 AM UTC:

@Fergus,

I am almost done with the castling. It was not that hard. I have left the normal stalemated subroutine which took care properly of the moves display. Also I am handling the flag sets and unsets properly as far as I can see. What I still need to do is delete a variable from wcastle or bcastle as the rook gets moved. How do I delete a value from an array?


🕸Fergus Duniho wrote on Tue, Jul 13, 2021 03:38 PM UTC in reply to Aurelian Florea from 11:51 AM:

What I still need to do is delete a variable from wcastle or bcastle as the rook gets moved.

That shouldn't be necessary, as other factors will determine that future castling moves are illegal without doing this.

How do I delete a value from an array?

Once the King has castled, it might be a bit of an optimization if you set wcastle or bcastle to an empty array, but it shouldn't be necessary.


Test[Subject Thread] [Add Response]
🕸Fergus Duniho wrote on Tue, Jul 13, 2021 03:47 PM UTC:

Posting from Chrome in Windows 10.


🕸Fergus Duniho wrote on Tue, Jul 13, 2021 03:54 PM UTC:
Adding response from Chrome on my Likebook Mars.

🕸Fergus Duniho wrote on Tue, Jul 13, 2021 03:56 PM UTC in reply to Fergus Duniho from 03:54 PM:

Replying from Chrome on my Likebook Mars.


🕸Fergus Duniho wrote on Tue, Jul 13, 2021 04:15 PM UTC:
Adding response with Chrome on my Likebook Mars without being signed in first.

🕸Fergus Duniho wrote on Tue, Jul 13, 2021 04:22 PM UTC in reply to Fergus Duniho from 04:15 PM:

Replying from Chrome on my Likebook Mars without being signed in first.


The birth of 3 new variants - part 2 : Grand Apothecary Chess Modern[Subject Thread] [Add Response]
Aurelian Florea wrote on Thu, Jul 15, 2021 07:57 AM UTC in reply to Fergus Duniho from Tue Jul 13 03:38 PM:

@Fergus Then I do not understand why after I move the rook I can castle with the cannon on the field that was supposed to be used only for the rook. I think I haven't explained that properly but only one castle is aloud. This is not free castling. So this is why I asked about wcastle and bcastle.


🕸Fergus Duniho wrote on Thu, Jul 15, 2021 05:36 PM UTC in reply to Aurelian Florea from 07:57 AM:

I do not understand why after I move the rook I can castle with the cannon on the field that was supposed to be used only for the rook.

So far, you have not made it clear that the King moves to a different space when castling with each piece. The rules you have underneath the game do not even mention castling. The castle subroutine was not written with such a rule in mind. You might be able to make it work by adjusting the values of bcastle and wcastle after a Rook moves.

I think I haven't explained that properly but only one castle is aloud.

Castling is allowed only once, which I understand, but what you say next doesn't fit with you trying to say that. Are you trying to say that the King has only once space it can go to when castling with a certain piece?

Regarding your preset, I don't understand why you are using four colors for checkering the board. Also, the dark blue squares do not contrast well with the color used for highlighting legal moves, which makes it hard to see legal moves highlighted on those squares. Additionally, your rules could use images of the pieces, so that someone looking at a piece on the board can more easily tell how it moves. Remember to use the shortcodes for displaying pieces, so that the piece images below match those on the board no matter what piece set is used.


H. G. Muller wrote on Thu, Jul 15, 2021 07:03 PM UTC:

@Aurelian: Just out of curiosity: what happens when you use the Play-Test Applet to convert the Interactive Diagram you made to GAME code? Does the castling work as intended then?


Aurelian Florea wrote on Fri, Jul 16, 2021 03:00 PM UTC in reply to H. G. Muller from Thu Jul 15 07:03 PM:

No ideea I'll Try it!


Aurelian Florea wrote on Tue, Jul 20, 2021 01:38 PM UTC in reply to Fergus Duniho from Thu Jul 15 05:36 PM:

@Fergus,

I still need to understand how to delete a value from an array in order to remove the necessary value from wcastle or bcastle.


🕸Fergus Duniho wrote on Wed, Jul 21, 2021 05:19 PM UTC in reply to Aurelian Florea from Tue Jul 20 01:38 PM:

I still need to understand how to delete a value from an array in order to remove the necessary value from wcastle or bcastle.

You can unset an array element if you know its key. For example:

set ra array a b c d e f g h i j k l m n o p q r;
unset ra.4; // removes e from array

But what if you just know the element you want to delete and not its key? I have now added a diff operator to return an array difference. When an argument isn't already an array, it gets turned into a single element array. So, this code removes j1 from wcastle.

set wcastle d1 c1 j1 k1;
set wcastle diff #wcastle j1;

Aurelian Florea wrote on Thu, Jul 22, 2021 04:49 AM UTC:

Thank you, Fergus!


Aurelian Florea wrote on Fri, Jul 23, 2021 07:22 AM UTC in reply to Fergus Duniho from Wed Jul 21 05:19 PM:

With your piece of code I have tested my idea and made it work as intended. Thanks once again, Fergus!


25 comments displayed

EarliestEarlier Reverse Order LaterLatest

Permalink to the exact comments currently displayed.