[ 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 ]Latest Ratings and CommentsLater ⇩Reverse Order⇧ Earlier⇩ Earliest⇧The birth of 3 new variants - part 2 : Grand Apothecary Chess Modern[Subject Thread] [Add Response]Aurelian Florea wrote on 2021-07-23 EDTWith your piece of code I have tested my idea and made it work as intended. Thanks once again, Fergus! Aurelian Florea wrote on 2021-07-22 EDTThank you, Fergus! Fergus Duniho wrote on 2021-07-21 EDT 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 2021-07-20 EDT@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. Aurelian Florea wrote on 2021-07-16 EDTNo ideea I'll Try it! H. G. Muller wrote on 2021-07-15 EDT@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? Fergus Duniho wrote on 2021-07-15 EDT 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. Aurelian Florea wrote on 2021-07-15 EDT@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. Test[Subject Thread] [Add Response]Fergus Duniho wrote on 2021-07-13 EDTReplying from Chrome on my Likebook Mars without being signed in first. Fergus Duniho wrote on 2021-07-13 EDTAdding response with Chrome on my Likebook Mars without being signed in first. Fergus Duniho wrote on 2021-07-13 EDTReplying from Chrome on my Likebook Mars. Fergus Duniho wrote on 2021-07-13 EDTAdding response from Chrome on my Likebook Mars. Fergus Duniho wrote on 2021-07-13 EDTPosting from Chrome in Windows 10. The birth of 3 new variants - part 2 : Grand Apothecary Chess Modern[Subject Thread] [Add Response]Fergus Duniho wrote on 2021-07-13 EDT 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. Aurelian Florea wrote on 2021-07-13 EDT@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 2021-07-12 EDT 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 2021-07-12 EDT@Fergus, Why in the castle subroutine in fairychess.txt include file the line unsetflag #RPOS; is commented? Fergus Duniho wrote on 2021-07-08 EDTI 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. Fergus Duniho wrote on 2021-07-08 EDT 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 2021-07-08 EDTTest. I keep getting the error message, "There is no comment to post." Aurelian Florea wrote on 2021-07-08 EDTI have repeated all my tests. The same two problems appear. Fergus Duniho wrote on 2021-07-08 EDT 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 2021-07-08 EDTI have forgotten about that: https://www.chessvariants.com/play/pbm/play.php?game=Grand+Apothecary+Chess+2&settings=Default&submit=Edit Fergus Duniho wrote on 2021-07-08 EDTCan you give me a link to the preset you're working on? Aurelian Florea wrote on 2021-07-08 EDT@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. 25 comments displayedLater ⇩Reverse Order⇧ Earlier⇩ Earliest⇧Permalink to the exact comments currently displayed.