Comments/Ratings for a Single Item
@Fergus,
I have moved the buggy code from the presets named apothecary-classic and apothecary-modern to the apothecary2working and apothecary1working.
The code I had mentioned before:
if flag f2:
if moved == K:
move $dest $origin; // Temporarily undo King move
if sub checked $origin:
if not or checkleap $origin $dest 1 0 checkleap $origin $dest 1 1:
die A King may not use the special moves out of check.;
endif;
endif;
move $origin $dest;
endif;
endif;
introduces a bug. Sometimes the message A King may not use the special moves out of check. is displayed seemingly randomly when non-king pieces are moved. That I had checked with the play at same location feature.
Have you any idea on how to fix this bug?
It sounds like you modified the code of an ongoing game in a way that retroactively made a past move illegal.
@Fergus,
I have copied the code from Apothecary-Modern here, and when I test the preset it seems fine, but when I try to move in an ongoing game of Apothecary Classic, I receive the error saying I've made special moves out of check.
Any idea why?
@Thor
I had sent you an invitation with the new preset.
In the light of recent disuctions in the sister game, I have updated the rules for this game and brushed up a bit the article.
Also the preset allows the game to be played here.
I'm on my ereader right now and won't be back on my computer until tomorrow morning, which is even later than your morning. My main suggestion for now is to replace #last_type_piece with var last_type_piece in the four Joker* functions, because this sometimes makes a difference.
Any joker move would do.
you can find the preset in question. Just move a white mameluke (the camel picture), and then try to move the joker.
Without seeing the game in which that is a move, I cannot tell what is going on.
Now when I try to move the joker in a correct manner I get this:
You may not move your White Joker from e1 to f4.
I recognize this line. It is from the post move section and it prevents things like moving one's queen like a knight.
As no moves were displayed either, I think this could be from an error in updating the joker's identity.
Stick to one or the other. I wasn't paying careful attention to what I already wrote.
You have wrote both last_piece_moved and last_type_moved. Are they different entities and I'm missing something or something else?
The function '#last_piece_moved' has not been defined. Its arguments are e10 f2
A variable appears as a string literal when it has not been defined. Make sure that last_piece_moved has a value assigned to it.
The function 'White_Joker-Range' has not been defined. Its arguments are e1
I didn't give you any code for defining this, but it needs to be defined.
def White_Joker-Range fn join str_replace "Black_" "White_" #last_piece_moved "-Range" #0; def Black_Joker-Range fn join str_replace "White_" "Black_" #last_piece_moved "-Range" #0;
Now the error is ;
The function 'White_Joker-Range' has not been defined. Its arguments are e1
Yes, you are correct, it was the joker, but now I'm getting:
The function '#last_piece_moved' has not been defined. Its arguments are e10 f2
That happens in the checked subroutine at the line:
if fn const alias #piece #from var king
I had solved that one. There was a line where I wrote last_piece_moved instead of last_type_moved.
That kind of error comes from not assigning a codename to a label you use for notation. It could be any piece. Make sure every piece in the game is fully defined.
For now I use code which starts the joker on the board and not in hand. That to make it easier to isolate bugs.
But I'm getting the error:
The function '' has not been defined. Its arguments are e10 f2
It is at the for each where checks are tested. Could it be because of the special king?
Since I made White_Joker and Black_Joker separate pieces, use this code in White's Post-Move section:
if != const alias $moved White_Joker: set last_type_moved const alias $moved; endif;
Use the same code for Black's but substitute Black_Joker for White_Joker.
I think these should work. Where a piece has a different definition for each side, it will use that for the piece on its own side. The other code for setting last_piece_moved should be used with this. This variable should be initialised in the Pre-Game section, and it should be updated in each Post-Move section. I rewrote None to include the two arguments for origin and destination as other piece functions do. Since it's a contradiction, it will always return false.
def None == #0 #1 and != #0 #1; def White_Joker fn str_replace "Black_" "White_" #last_piece_moved #0 #1; def Black_Joker fn str_replace "White_" "Black_" #last_piece_moved #0 #1;
Would the White Joker be able to move as a Black Pawn or as a White Pawn?
So far I've played whith the joker always imitating it's own pieces when they have different moves. So the white joker moves like a white pawn when imitating a black pawn. That makes sense to me more as generally speaking pawns advance, so should the joker. Maybe if you think about it a little you would feel quite awkward with your piece moving backwards. But when moving as a pawn the joker may not promote.
Thanks for your help!
First of all, you want to keep track of the last type of piece moved, and to start off with, it needs an initial default value.
set last_type_moved None; def None false;
I'm thinking this could work for tracking the last piece moved:
if != const alias $moved Joker: set last_type_moved const alias $moved; endif
This keeps track of the last piece moved using its codename, which matches the function name used for how it moves. But now I have another question. Suppose that the last piece moved was a Black Pawn. Would the White Joker be able to move as a Black Pawn or as a White Pawn?
I have added some clarifications regarding how the joker moves in the beginning and when imitating the enemy joker. They can be found at the end of the rules chapter.
25 comments displayed
Permalink to the exact comments currently displayed.