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 ]

Comments/Ratings for a Single Item

Earlier Reverse Order LaterLatest
New Grand Apothecary Chess Error.[Subject Thread] [Add Response]
Aurelian Florea wrote on Sun, Dec 12, 2021 01:06 PM UTC:

HG, Have you changed something to the randomization algorithm? The randomization of 2 pieces is now different among the two players on all 3 games!


H. G. Muller wrote on Sun, Dec 12, 2021 06:26 PM UTC in reply to Aurelian Florea from 01:06 PM:

Well, I fixed the previous problem we had as Fergus suggested, by retrieving the shuffle made when the game was created from the constant 'startshuffle', like:

  if isconst startshuffle:        // shuffle has already been determined
    setsystem space @startshuffle;// retrieve it
  else:                           // new game; must shuffle
    ... // perform shuffling on $space
    setconst startshuffle $space;        // save the shuffle for persistent use
  endif;

That is, Fergus told me to write an @ before it, otherwise a wrong, uninitialized variable was retrieved, which led to a board of all white pawns. This seemed to work at the time. If you get a new shuffle now, it can only be because the test "isconst startshuffle" returns false, and it starts making a new shuffle rather than retreiving the old one (which apparently for some reason ceased to exist). If you shuffle again you are unlikely to get the same position. Perhaps Fergus knows how a constant can disappear.


Aurelian Florea wrote on Sun, Jan 9, 2022 12:03 PM UTC in reply to H. G. Muller from Sun Dec 12 2021 06:26 PM:

@Fergus, Could you take a look at the latest on this post?


Aurelian Florea wrote on Fri, Mar 4, 2022 04:57 AM UTC:

HG & Fergus

Hello, Something seems wrong with all my grand apothecary chess presets when the imitator has to move. It always imitates a pawn regardless of what the previous player does. Any of you 2 has a reason? Links Below:

https://www.chessvariants.com/play/pbm/play.php?game=Grand+Apothecary+Chess+1&settings=Applet

https://www.chessvariants.com/play/pbm/play.php?game=Grand+Apothecary+Chess+2&settings=Applet

https://www.chessvariants.com/play/pbm/play.php?game=Grand+Apothecary+Chess+3&settings=Applet


🕸Fergus Duniho wrote on Fri, Mar 4, 2022 01:48 PM UTC in reply to Aurelian Florea from 04:57 AM:

My guess would be that the automatic code generator was never designed to handle imitators.


Aurelian Florea wrote on Fri, Mar 4, 2022 04:49 PM UTC in reply to Fergus Duniho from 01:48 PM:

It worked before! Hopefully HG knows better!


Aurelian Florea wrote on Sun, Mar 6, 2022 04:11 AM UTC:

HG, are you here?


Aurelian Florea wrote on Sat, Mar 12, 2022 04:22 PM UTC in reply to Aurelian Florea from Sun Mar 6 04:11 AM:

It seems no one knows what happened. It worked before.


H. G. Muller wrote on Sat, Mar 12, 2022 09:05 PM UTC in reply to Aurelian Florea from 04:22 PM:

It seems the J/j piece is not defined as an imitator. In the Pre-Game code the legdefs array should be initialized for the Imitator as

1 -2  0  1   16777219 // joker(1826)
0
1 -2  0 -1   16777219 // joker(1832)
0

But instead of a -2 you now have a 1 there.

How was this Pre-Game code created? Did you paste an existing Interactive Diagram into the Play-Test Applet, or did you select the pieces one by one from the table?


Aurelian Florea wrote on Sun, Mar 13, 2022 07:44 AM UTC in reply to H. G. Muller from Sat Mar 12 09:05 PM:

To be honest I don't recall it is a long time ago. But it worked before. Anyway I'll make the change.


Aurelian Florea wrote on Sun, Mar 13, 2022 07:53 AM UTC in reply to H. G. Muller from Sat Mar 12 09:05 PM:

I have made the change and now it works! May I enquire what the -2 stands for?


H. G. Muller wrote on Sun, Mar 13, 2022 12:55 PM UTC in reply to Aurelian Florea from 07:53 AM:

Each line in the legdefs array represents the leg of a move, and contains either 5 or 4 numbers. The first leg always contains 5 numbers, the first number indicating how many legs the move has. A zero there indicates no more moves follow for that piece.

The other 4 numbers are range (1 = leaper), x-step y-step and 'mode'. The latter describes what must occupy the target square for the leg to be possible.

Ranges smaller than 1 are of course meaningless, and those are used to indicate special cases that cannot be described as a (repeated) step. Such as imitation. These 'invalid' rages are recognized, and will cause execution of dedicated GAME code to handle the particular case. E.g. -1 would be used for the variable range of Pawns moving up to the board half. A -3 would cause calling of a user-supplied GAME code subroutine for generating the move.

I guess there is currently a mismatch between how the Interactive Diagram handles imitation (indicating it by some bit in the 'mode') and how the betza.txt GAME-code include file handles it (through range = -2). It would have been the task of the Play-Test Applet to make that translation when you make it generate GAME code. I cannot recall changing any of these. But I must have, if you say it worked before. In any case I should fix the Play-Test Applet to emit the -2 as range when the mode specifies imitation.


Aurelian Florea wrote on Sun, Mar 13, 2022 03:16 PM UTC in reply to H. G. Muller from 12:55 PM:

Thanks, HG. I got it. Good luck!


Aurelian Florea wrote on Thu, Mar 17, 2022 06:15 PM UTC in reply to Aurelian Florea from Sun Mar 13 03:16 PM:

HG, Actually in the following it is not about an error. But I need to figure out how to edit the already done preset so that when the joker that imitates a pawns it inherits only it's basic properties, no double move, en-passant, promotion. The way I had done that earlier was to treat the pawn separately and when it is the case that it is the last piece for it I imitate a barren pawn piece. This worked fine. But I do not know how to do it here. The diagram will still not be able to do that and that is fine for a newcomer, the game is complicated enough as is, but for the game code I think I can do it, just guide me a bit to how.


H. G. Muller wrote on Thu, Mar 17, 2022 07:17 PM UTC in reply to Aurelian Florea from 06:15 PM:

The GAME code in the betza.txt include file updates a variable 'toimitate' in its HandleMove routine, so that it will contain the ID of the piece to imitate on the next move. You could use the trick with the dummy piece also here. Say that its ID would be X or x, you could add this code in the Post-Move 1 section after the call to Handle move:

set toimitate cond == #toimitate p x #toimitate;

And in the Post-Move 2 section the same, but with capital P and X. The == #toimitate p tests whether the next piece to imitate would be a pawn, and if so, changes it to x, but otherwise leaves it as it was.


Aurelian Florea wrote on Thu, Mar 17, 2022 07:25 PM UTC in reply to H. G. Muller from 07:17 PM:

Thanks HG!


H. G. Muller wrote on Fri, Mar 18, 2022 01:04 PM UTC in reply to Aurelian Florea from Thu Mar 17 07:25 PM:

I now fixed the Play-Test Applet's GAME-code generation such that it does use the correct way for specifying a move as imitation in the 'legdefs' table it generates.

One caveat: the trick the betza.txt include file uses for determining whether moves are legal during highlighting is not reliable when imitators are present. Because it determines the pinned pieces and attacked squares before the move. And the move will usually change what the imitator is immitating. So it is recommended to use highlighting of all pseudo-legal moves, by specifying

set pseudo 1;

at the end of the Pre-Game section.


Aurelian Florea wrote on Fri, Mar 18, 2022 06:40 PM UTC in reply to H. G. Muller from 01:04 PM:

Thanks, for that HG!


Aurelian Florea wrote on Mon, Mar 21, 2022 08:47 PM UTC in reply to H. G. Muller from Fri Mar 18 01:04 PM:

It seems in the game code I can castle out of check and that should not happen.


Daniel Zacharias wrote on Tue, Mar 22, 2022 12:50 AM UTC in reply to Aurelian Florea from Mon Mar 21 08:47 PM:

I think it just highlights the move as legal but doesn't let you actually do it.


Aurelian Florea wrote on Tue, Mar 22, 2022 07:20 AM UTC in reply to Daniel Zacharias from 12:50 AM:

I verified this. You are correct!


H. G. Muller wrote on Tue, Mar 22, 2022 07:46 AM UTC in reply to Aurelian Florea from 07:20 AM:

That is a consequence of pseudo-legal highlighting. The issue of moving into / out of / through check is what makes the difference between fully legal and pseudo-legal moves.


Aurelian Florea wrote on Tue, Mar 22, 2022 08:17 AM UTC in reply to H. G. Muller from 07:46 AM:

Ok!


Aurelian Florea wrote on Fri, Apr 22, 2022 06:56 AM UTC in reply to H. G. Muller from Thu Mar 17 07:17 PM:

@HG, Hello I want to use the dummy piece trick here the way you suggested a while ago. I don't know how to define the dummy pawn (a pawn with no capture, en passant or promotion).

EDIT: I mean without having to redo the diagram from scratch.

Can you help me?


25 comments displayed

Earlier Reverse Order LaterLatest

Permalink to the exact comments currently displayed.