Check out Glinski's Hexagonal Chess, our featured variant for May, 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
Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Fri, Sep 23, 2022 06:30 AM UTC in reply to Greg Strong from Thu Sep 22 11:09 PM:

To solve the ambiguity problem in 1-step castling (or in other castlings where the castling piece can also move multiple squares on its own, such as that silly 'guarding' of the Queen in Enhanced Omega Chess), the Diagram uses the tilde instead of the hyphen (or nothing) as connecting sign for indicating castlings, like K~d1. But I like to stick to conventional SAN where this is possible.


Greg Strong wrote on Thu, Sep 22, 2022 11:09 PM UTC in reply to Daniel Zacharias from 09:17 PM:

You could just use O-O for everything along with the king's destination square, like O-O b1

You could.  But, at that point, I would ask what value the "O-O" is bringing.  Wouldn't the more standard "e1b1" also accomplish that?  Although, I guess this would address the issue with (e.g., Wildebeest Chess) where the King can move a single space and still castle.  Perhaps if either "O-O" or "O-O-O" is followed by the notation of a square, it would mean castling to that square (and there would be no difference between "O-O" and "O-O-O")


Daniel Zacharias wrote on Thu, Sep 22, 2022 09:17 PM UTC in reply to H. G. Muller from 09:50 AM:

You could just use O-O for everything along with the king's destination square, like O-O b1. If you want to preserve O-O-O, it could be understood as referring to the left half of the board from White's perspective, while O-O refers to the right half.


Greg Strong wrote on Thu, Sep 22, 2022 03:06 PM UTC in reply to H. G. Muller from 09:50 AM:

I don't think the O-O, O-O-O thing scales very well. What about games with an odd number of files and the King starts in the middle?


💡📝H. G. Muller wrote on Thu, Sep 22, 2022 09:50 AM UTC in reply to Gerd Degens from Mon Aug 15 06:36 AM:

I have somewhat of a dilemma concerning the move notation for castling in the Interactive Diagram. Normally King-side castling is O-O, Queen-side castling is O-O-O, both for white and black. This then corresponds to short and long castling, respectively.

But what if the Kings start closer to the a-file? Would it still make sense to keep calling the a-side the Queen side, and use O-O-O for that castling. I know that the official notation for Chess960 does this, but that is really another case, because the King there can start anywhere, but at least ends on the c-file, like in orthodox Q-side castling. So it is indeed like a long castling, only with messed-up initial position because of the shuffling.

But what if the King in a-side castling ended on the b-file. Does it still deserve to be written as O-O-O? I encountered this problem in Elven Chess, which is unusual in that it has rotation symmetry rather than reflection symmetry in the initial setup; usually variants that have that do not have castling, but Elven Chess does. The white King starts on the f-file, and moves 3 spaces to i1 on the 10-wide board. So it would be normal to call that O-O, and the castling to c1 O-O-O.

But now what for black? His King starts on e10, and castling would bring it to b10 or h10. I would be inclined to call the castling to b10 O-O now, not O-O-O.

Any ideas what we should elevate to standard here?


Gerd Degens wrote on Mon, Aug 15, 2022 06:36 AM UTC in reply to H. G. Muller from Sun Aug 14 05:54 PM:

Thank you H.G., that's how it will be for sure. Sounds to me like from another star. It means to me that I will not be able to do it on my own.


💡📝H. G. Muller wrote on Sun, Aug 14, 2022 05:54 PM UTC in reply to Gerd Degens from 04:21 PM:

In addition to defining normal chess, but without normal promotion (maxPromote=0), you would have to embed a JavaScript function WeirdPromotion that would promote every piece (except King) to the type that belongs to the destination square.


Gerd Degens wrote on Sun, Aug 14, 2022 04:21 PM UTC:

What can be done to play the game Avatar Chess online?


Aurelian Florea wrote on Sat, Aug 13, 2022 06:44 PM UTC in reply to H. G. Muller from 02:52 PM:

Ok, I'll try it


💡📝H. G. Muller wrote on Sat, Aug 13, 2022 02:52 PM UTC in reply to Aurelian Florea from 06:43 AM:

I thought the changes I made on August 1 fixed that? As long as the game you try to past is legal and unambiguous, of course.


Aurelian Florea wrote on Sat, Aug 13, 2022 06:43 AM UTC in reply to H. G. Muller from Mon Aug 1 10:47 AM:

Hello, HG

Have you made any progress with the saving and loading in the interactive diagrams?


💡📝H. G. Muller wrote on Mon, Aug 1, 2022 10:47 AM UTC in reply to Aurelian Florea from 10:18 AM:

While it is certainly possible to make illegal moves in the Diagram, this cannot be the full explanation. Because the Diagram would also see that move is ambiguous during generation of the notation, and then would disambiguate it. So when I move that Kangaroo to i10 in the position where the loading of the game stops, it adds the move Ghi10 to the game, rather than Gi10. It constructs the notation such that its parser can always read it back unambiguously. It will even allow different piece types to have the same piece ID, and will already add disambiguators if two pieces with the same ID can go to the same square. (This can be useful when you implement location-dependent moving by defining different types to be used in different locations for what is shown as the same piece.) A slight difference with standard notation in orthodox Chess is that it disambiguates based on pseudo-legality only, and won't rule out alternative moves just because they expose you to check. This because not all variants do have a checking rule.


Aurelian Florea wrote on Mon, Aug 1, 2022 10:18 AM UTC in reply to H. G. Muller from 09:26 AM:

With the G move it could mean that I have personally made an illegal move! Sorry for that


💡📝H. G. Muller wrote on Mon, Aug 1, 2022 09:26 AM UTC in reply to Aurelian Florea from Sun Jul 31 12:17 PM:

OK, I found (and corrected) two problems in the Diagram script. When I added the possibility to include comments (enclosed in braces) in a pasted game some time ago, I had broken the reading of the shuffle specifier at the start of the game (which is also in braces). That was not the only problem, however: when the Diagram of a shuffle game is first shown, it displays as the 'nominal position', without any shuffling. But the initial value of the random seed used for shuffling (123456789) does not correspond to 'no shuffling'. But it was saved with the game. And if the game then was pasted back it was taken seriously, and the corresponding shuffle was executed. For now I solved this by suppressing shuffling if the random seed is 123456789.

I think this should solve all problems in the Diagram script. (Be sure to flush your browser cash or you would keep using the old script!) But there still is a problem with the games you posted: if I paste the 'alert' game into the Diagram on your alert page, it complains that Gi10 is an illegal move. And as far as I can tell, it indeed is one: G means Kangaroo there, which is defined as HFD, and  it starts (unshuffled) at h12. So Gi10 is an N jump. Since there is another Kangaroo on the board, and the specified destination square is illegal for both, it has no idea which of the two should move there, and throws up an 'ambiguous illegal move' error.


Aurelian Florea wrote on Sun, Jul 31, 2022 12:17 PM UTC in reply to H. G. Muller from 12:12 PM:

And probably the same goes for the other two games!


💡📝H. G. Muller wrote on Sun, Jul 31, 2022 12:12 PM UTC in reply to Aurelian Florea from 11:58 AM:

OK, I see. When I only paste the first Pawn moves, it works. As soon as I include 4... Gi10 in the alert version it throws up a popup complaining about an illegal move. When I include the number between braces it ignores the pasting entirely.

I suspect that there is something wrong setting up the position, since these are shuffle games. I will have a look at this.


Aurelian Florea wrote on Sun, Jul 31, 2022 11:58 AM UTC in reply to H. G. Muller from 10:06 AM:

I have copied a non finished game from my each grand apothecary diagrams. I have put it in a notepad text file. I am trying to copy it back but it does not work with edge. Firefox does give me that error though. Look try it for yourself:

The alert game:

{123456789} 1. f7 i8 2. h6 h8 3. f6 g9 4. e7 Gi10 5. Nf5 Ni9 6. Gi6 Mi12 7. Ic6 Vk7 8. Ixi12 Gxi12 9. Jh4 Oj9 10. Gg6 Vk8 11. i6 Vk9 12. Oc6 d10 13. i7 Wk10 14. ixh8 Wxh8 15. Gj6 Oh9 16. Gj8 Vj9 17. Wk5 Oxc6 18. Xxc6 We6 19. Jxe6 Vxj8 20. Nh4 Ij9 21. Je4 Gi10 22. Bg6 Ik8 23. Wxi8 Gxi8 24. k7 Vl9 25. Jxi8 Fk9 26. Vj6 Fxg6 27. Uxg6 Ii10 28. Vj8 Vxj8 29. Jxi9 Nh11 30. Jxh11 Qxh11 31. kxj8 Ixf7 32. Uxf7 Yxf7 33. Ne5 Ye9 34. Jxa12 Jxa12 35. Fj7 Bxj5 36. Rlk3 g10 37. Rk8 Ff9 38. Fb6

The classic game:

{123456789} 1. f7 i8 2. h6 h8 3. f6 g9 4. e7 Ek10 5. Nf5 Ne10 6. i7 Yh9 7. ixh8 gxh8 8. Uxh8 Bg9 9. Ui9 Hh11 10. Ng7 Yi11 11. Hh4 Yg10 12. Uj8 Eh10 13. Ul9 Ei9 14. Uh5 Yc8 15. Ee4 Ya7 16. Fd5 f8 17. exf8 Bxf8 18. Fb7 Bd6 19. Le5 Bxe5 20. dxe5 Nd8 21. Fd5 Le10 22. Hj6 Lf10 23. Nh9 Eh10 24. Nxf10 exf10 25. Uxk11 Ii12 26. Xd7 Fi10 27. Uxi12 Jxi12 28. Xxd8 Fxj6 29. Xxj6 d9 30. Ni5 Uk10 31. Eeh4 Je11 32. Je4 Ng9 33. f8 Ni6 34. Exi6 Bxi6 35. j5 Bk8 36. l7 Ff9 37. Rab3 Yb9 38. Txk8

The modern game:

{123456789} 1. f7 i8 2. h6 h8 3. f6 g9 4. e7 Ci10 5. Nef5 Nh9 6. Je4 Sh11 7. Jf4 d9 8. i5 Nee9 9. Sh4 We10 10. g6 Si11 11. Wh5 Wd7 12. Jd5 Wc8 13. Je4 Wd7 14. Sg5 Wxe4 15. Dxe4 Nk9 16. Dxd9 Cd10 17. Da8 b9 18. Db6 Nc8 19. Dc7 Shf9 20. Dd5 Yb11 21. Si4 Sk8 22. Xi7 Sj7 23. Xxi8 Sxg5 24. Nxg5 Nxi8 25. h7 Nk9 26. b7 Nb10 27. We6 Sg10 28. Xc6 Yh9 29. Ya6 Yj8 30. Nh4 e10 31. Nhi6 Yh9 32. Fc7 Sh11 33. Ck5 b8 34. Fg8 Te11 35. Lh4 Ni7 36. Yh3 f9 37. Fi8 Xi9 38. Cxi7


💡📝H. G. Muller wrote on Sun, Jul 31, 2022 10:06 AM UTC in reply to Aurelian Florea from 07:36 AM:

I don't think this can be the problem. But you will have to be more specific about what exactly you do, and what exactly then doesn't work. When I use Edge with the example Diagram for Capablanca in the Interactive Diagrams article, play f4, f5, open the AI bar, copy the game displayed at the bottom of it, reload the page so that I get a fresh Diagram, and then paste the game back, it advances both f-Pawns. I can then play Nh3, and it replies with e5. That is all exactly as it should be.


Aurelian Florea wrote on Sun, Jul 31, 2022 10:03 AM UTC in reply to H. G. Muller from Sat Jul 30 09:05 PM:

It works a bit with Firefox, but the joker gives an ambiguous move error!


Aurelian Florea wrote on Sun, Jul 31, 2022 07:36 AM UTC in reply to H. G. Muller from Sat Jul 30 09:05 PM:

Well HG, for me it does not work. I use edge. Can this be the problem?


💡📝H. G. Muller wrote on Sat, Jul 30, 2022 09:05 PM UTC in reply to Aurelian Florea from 08:21 PM:

Yes it can, and you should be able to continue it in that case. Either by making a move, or pressing the Move button.


Aurelian Florea wrote on Sat, Jul 30, 2022 08:21 PM UTC in reply to H. G. Muller from 08:14 PM:

Can it be a non finished game?


💡📝H. G. Muller wrote on Sat, Jul 30, 2022 08:14 PM UTC in reply to Aurelian Florea from 02:46 PM:

There is no real save function. Under the buttons in the AI bar there is a text box where the game record will appear, and you can copy-paste that to a place where you want to store it. You can paste such a game back into that same text box to load it into the Diagram again.


Aurelian Florea wrote on Sat, Jul 30, 2022 02:46 PM UTC:

I remember there being a way to save and load games for the interative diagram. I cannot find where. Any ideas of how to do it?


💡📝H. G. Muller wrote on Tue, Jul 12, 2022 05:20 PM UTC in reply to Ben Reiniger from 04:34 PM:

Refresh your browser cache (Shift + reload on FireFox), or you would still be using the old Diagram script.


Ben Reiniger wrote on Tue, Jul 12, 2022 04:34 PM UTC:

The immobilizer works for me when moving pieces around, but not when playing against the AI.


💡📝H. G. Muller wrote on Mon, Jul 11, 2022 06:06 PM UTC in reply to Jean-Louis Cazaux from 05:22 PM:

Indeed, it would not make sense to use this in a FIDE context. But it might fit in with the Tenjiku-Shogi crowd. After all, getting paralyzed is not nearly as bad as getting burned.


Jean-Louis Cazaux wrote on Mon, Jul 11, 2022 05:22 PM UTC in reply to H. G. Muller from 02:02 PM:

Seems to work. What a mighty piece!


💡📝H. G. Muller wrote on Mon, Jul 11, 2022 02:02 PM UTC in reply to Aurelian Florea from Sun Jul 10 05:11 PM:

This is a test for how to implement immobilizers with the Interactive Diagram, through a user-supplied function BadZone(). The Queen here immobilizes all adjacent enemy pieces.

files=8 ranks=8 promoZone=1 promoChoice=NBRQ graphicsDir=/graphics.dir/alfaeriePNG/ squareSize=50 graphicsType=png pawn:P:ifmnDfmWfceF:pawn:a2,b2,c2,d2,e2,f2,g2,h2,,a7,b7,c7,d7,e7,f7,g7,h7 knight:N:N:knight:b1,g1,,b8,g8 bishop:B:B:bishop:c1,f1,,c8,f8 rook:R:R:rook:a1,h1,,a8,h8 queen:Q:Q:queen:d1,,d8 king:K:KisO2:king:e1,,e8

This was already possible before, by having the function BadZone() examine all board squares adjacent to the origin of the move, and vetoing the move (by returning non-zero) when an enemy immobilizer was found there. This was quite inefficient, though, as it would be done for every potential move of the immobilized piece.

I now changed the Diagram Script such that BadZone() can remember the result of any test it does in a variable 'frozen', set to -1 whenever move generation for a new piece starts. So that it can get the result of a previous test for the same piece from there, rather than redoing the test. And by setting frozen = 100 it can even abort generation of moves for the current piece altogether.


Aurelian Florea wrote on Sun, Jul 10, 2022 05:11 PM UTC in reply to H. G. Muller from 01:30 PM:

I see your point, HG. You are probably correct but I'll do it my way. It can't really hurt. Unless I blunder a bug anyway.


💡📝H. G. Muller wrote on Sun, Jul 10, 2022 01:30 PM UTC in reply to Aurelian Florea from 01:02 PM:

I understand that, but that is not a reason for allowing your opponent to promote, anymore than you would let him capture one of your Bishops with a Pawn (which would also give him a Bishop for a Pawn, if the Bishop was protected). In real games there never are any promotions 'early in the game'. At least not any where the promoted piece is allowed to survive. And there certainly will not be more than two. So if you want a Bishop to be available early in the game for the one-in-a-million case that someone would be allowed to promote and would want one, you might as well make it available in unlimited supply. How many games would have more than 2 promotions in total anyway? Usually the first promotion decides the game.


Aurelian Florea wrote on Sun, Jul 10, 2022 01:02 PM UTC in reply to H. G. Muller from 11:01 AM:

This game, like Gross chess has promotion limited by rank. Bishops are easier to promote earlier in the game.


💡📝H. G. Muller wrote on Sun, Jul 10, 2022 11:01 AM UTC:

I am not sure why you would even bother to limit the number of Bishop promotions to 2 (if the original Bishops are still present). Like anyone would ever want to promote to Bishop... In practice promotions would never occur when there still are enough super-pieces around to prevent them. So even with promotion to captured pieces only there would always be something much better than a Bishop available. It is quite inconceivable that the opponent would have blundered away so many pieces that he can no longer stop promotion, while you would not have lost a single piece better than a Bishop.

So it seems a totally useless rule. Even when you would grant an infinite supply of Bishops, no one would ever want to use one. Let alone 3.


Aurelian Florea wrote on Sun, Jul 10, 2022 10:35 AM UTC in reply to H. G. Muller from Sat Jul 9 06:01 PM:

Well I can manipulate the captured pieces array. I did that before! Thanks!


💡📝H. G. Muller wrote on Sat, Jul 9, 2022 06:01 PM UTC in reply to Aurelian Florea from 04:53 PM:

You cannot. The supply array is for indicating what piece types are in infinit supply. If a piece is not in there you can only promote to it when it was captured.


Aurelian Florea wrote on Sat, Jul 9, 2022 04:53 PM UTC in reply to H. G. Muller from 03:05 PM:

But how do I put 2 bishops in the supply array?


Aurelian Florea wrote on Sat, Jul 9, 2022 04:52 PM UTC in reply to H. G. Muller from 03:05 PM:

OK, Thanks


💡📝H. G. Muller wrote on Sat, Jul 9, 2022 03:05 PM UTC in reply to Aurelian Florea from Fri Jul 8 09:21 AM:

Sorry, I managed to produce a bug in this simple change after all, swapping the arguments of a GAME-code 'push' instruction. Now it should work, and I actually tested it on one of your presets.

BTW, the numbers you put in the supply array are meaningless. But they do not hurt.


Aurelian Florea wrote on Fri, Jul 8, 2022 09:21 AM UTC in reply to H. G. Muller from Thu Jul 7 08:29 PM:

No, it does not work with (P 10 p 10 X 10 x 10) nor with (P p X x)


💡📝H. G. Muller wrote on Thu, Jul 7, 2022 08:29 PM UTC in reply to Aurelian Florea from 03:52 PM:

Oh yes, I forgot to tell that. The rule that you cannot promote to pieces that are not captured and not in the supply array remains applicable. So it should allow 'promotion to self' if a pawn of that type was already captured, but this is probably not the way you tested it. So add p and x to the supply array.


Aurelian Florea wrote on Thu, Jul 7, 2022 03:52 PM UTC in reply to H. G. Muller from 09:20 AM:

It seems that staying a pawn does not work. Is that because the self pieces do not appear in the supply array?


Aurelian Florea wrote on Thu, Jul 7, 2022 01:08 PM UTC in reply to H. G. Muller from 09:20 AM:

@HG There is also a peculiar situation in the Grand Apothecary chess games given by the brouhaha squares. Technically pawns should not reach there and that is easily done by adjusting the promotab so that you are forced to promote before reaching the brouhaha squares. But I'm not sure how easy it is for the interactive diagram.


Aurelian Florea wrote on Thu, Jul 7, 2022 10:39 AM UTC in reply to H. G. Muller from 09:20 AM:

That is great. I'll be testing it soon!


💡📝H. G. Muller wrote on Thu, Jul 7, 2022 09:20 AM UTC in reply to Aurelian Florea from Wed Jul 6 01:17 PM:

I now implemented the 'self option' in the betza.txt include file:

Just remove the p and x from all the sets in the promotab, and replace it by the word self. (Always lower case, even in the sets of white pieces.) If this word is in the set the piece name of the moving piece will be added to the choices before further processing. This way you prevent there will be an x in the set when the mover is a p, or a p in the set when the mover is an x.

Perhaps you can test this; I did not test it myself, but it was a very simple change.


Aurelian Florea wrote on Wed, Jul 6, 2022 01:17 PM UTC in reply to H. G. Muller from 08:29 AM:

@HG,

On the previous rank the promoting pawn basically has a sergeant power (fWfA). This is to difficult to stop in my opinion.


catugo wrote on Wed, Jul 6, 2022 08:42 AM UTC in reply to H. G. Muller from 08:29 AM:

Thanks, HG!


💡📝H. G. Muller wrote on Wed, Jul 6, 2022 08:29 AM UTC in reply to Aurelian Florea from 07:09 AM:

Ah, sorry. I thought you wanted to allow both kinds of Pawns to promote to each other. But you want to exclude it. (Why would you want that, btw? It would be a nice tactical twist if it was allowed.)

I am afraid that BadZone cannot be used to veto promotions, because it does not get the promotion piece passed as a parameter. I wonder if it is worth it to implement some general solution for this problem, which can be summarized as that you want to allow the promoting pieces to refrain from promoting on some ranks, but you don't want to allow them to promote to each other. Adding their types to the possible promotion choices for that rank then would not work. It would be nice if a special symbol like 'self' could be added to the set of choices to indicate the type of the moving piece. I will think about it.

And you are right about the other thing: the AI of the Diagram appears to ignore the promotion restrictions.


Aurelian Florea wrote on Wed, Jul 6, 2022 07:09 AM UTC in reply to H. G. Muller from Sun Jul 3 02:08 PM:

A problem might be that if you allow both Pawn and Berolina as promotion choice, you don't only allow Berolina to promote to Pawn and vice versa, but you also allow Berolina and Pawn to stay themselves. Since the choice would make no sense on the last rank, where neither of these would have any moves, I suppose this is not a problem, but rather exactly what you want.

I don't see the way to ban promotion of regular pawns to berolina pawns and vice versa.


Aurelian Florea wrote on Mon, Jul 4, 2022 10:47 AM UTC in reply to H. G. Muller from Sun Jul 3 02:08 PM:

I think I have found a bug in the diagram below:

https://www.chessvariants.com/rules/grand-apothecary-chess-alert

The AI, while playing black, promotes to rook at rank 4 (1 being the brouhaha rank). It supposed to de able to promote to rook since the 3 rank downwards. The weird thing is that I checked it manually with the diagram and it worked fine. The trouble is only when the move button is pressed.


Aurelian Florea wrote on Sun, Jul 3, 2022 03:17 PM UTC in reply to H. G. Muller from 02:08 PM:

Thanks for the clarifications, HG


💡📝H. G. Muller wrote on Sun, Jul 3, 2022 02:08 PM UTC in reply to Aurelian Florea from 12:25 PM:

The preset will allow promotion to all captured pieces, or to a piece that is in the 'supply' set. So you should put all pieces you can promote to even when they are not yet captured in that set. The GAME-code generated by the diagram also contains an array ('promotab') that per board rank lists which pieces you could promote to on that rank. If both the normal pawn and the Berolina are in the set of allowed choices (and either have been captured or are mentioned in 'supply'), you will be allowed to select those.

A problem might be that if you allow both Pawn and Berolina as promotion choice, you don't only allow Berolina to promote to Pawn and vice versa, but you also allow Berolina and Pawn to stay themselves. Since the choice would make no sense on the last rank, where neither of these would have any moves, I suppose this is not a problem, but rather exactly what you want.


Aurelian Florea wrote on Sun, Jul 3, 2022 12:25 PM UTC in reply to Aurelian Florea from Mon Jun 27 04:33 PM:

@HG

In all my 3 Grand Apothecary games pawns do not promote, except to other pawns. I have identified the error coming from the supply vector. It is defined like this:

set supply (P p X x); // in infinite supply

But not the other pieces that are there initially. How do I fix this as the interactive diagram works well.

And by the way, also the regular pawn is able to promote to berolina and the berolina to regular pawn. Is that fixable?


Aurelian Florea wrote on Sat, Jul 2, 2022 07:54 PM UTC in reply to H. G. Muller from 07:06 PM:

It is just that I remember an older discussion. Thanks for clarifications!


💡📝H. G. Muller wrote on Sat, Jul 2, 2022 07:06 PM UTC in reply to Aurelian Florea from Thu Jun 30 03:42 PM:

Are you sure this is the problem? Because what you describe is what I already do. (That is, I set it to the weighted average of the value of all pieces, where the weight is equal to the value. This because I assume that stronger pieces will be moved more often than weak pieces. And I subtract 30% of the variation in this, because I assume the opponent will adapt his move choice to make the imitator less useful, if he can, by moving more weak pieces than he otherwise would.) When you click the 'move' header in the piece table to see the values, you will see that the imitator does have a finite weight.

The procedure could be a bit improved. (E.g. I now take the average of all pieces, while it should really just be opponent pieces. But if that would be very different the game is decided anyway. And it does not take account of an imitator's fixed moves, if it had any (e.g. if you define WfI).) But whatever flaws it has now, it should never lead to thinking the imitator is worthless.

Perhaps the problem is simply that the AI doesn't search deep enough to see that an Imitator can be easily trapped.


Aurelian Florea wrote on Thu, Jun 30, 2022 03:42 PM UTC in reply to Aurelian Florea from Mon Jun 27 04:33 PM:

@HG,

It is really annoying that the imitators are traded for nothing. Maybe you can do something about this when you find the time, like when the move button is triggered the value of the imitator is updated with the average of the values of foe pieces.


Aurelian Florea wrote on Mon, Jun 27, 2022 04:33 PM UTC in reply to H. G. Muller from 02:05 PM:

@HG,

All my tests are working. Thanks!


💡📝H. G. Muller wrote on Mon, Jun 27, 2022 02:05 PM UTC in reply to Aurelian Florea from 01:12 PM:

Oh sorry, my bad. I mistakenly thought that the 4-step castlings always ended on the Rooks. But this is only true on the king-side. That means we have to define another set 'badRook' to specify where Rook castlings cannot go, different from the set that specifies where the Rooks are. (And use that in BadZone when we see the locust square is at a Rook.)

set badRook (c2 k2 c13 k13);
def BadZone #locust and match #locust #partners and cond match #locust #rooks match #dest #badRook match #dest #badCannon =O =dest =locust =D =P;

Aurelian Florea wrote on Mon, Jun 27, 2022 01:12 PM UTC in reply to H. G. Muller from 12:34 PM:

It seems we are almost there. The 4 squares to the left castling with the rook should also be suppresed.


💡📝H. G. Muller wrote on Mon, Jun 27, 2022 12:34 PM UTC in reply to Aurelian Florea from 11:40 AM:

OK, I see what the problem is. The way the Play-Test Applet generated GAME-code for the King's castling moves that you specified, will lead to the 3-step moves of the King appearing twice in the legdefs array. Once for the Rook, and once for the Cannon castling. The code in the included betza.txt does not need that (because each specified castling step would automatically work with any partner spesified in the 'partners' array), and is in fact not resitant to that. When it gets the first match with the input move (which it supposes to be the only match), it already executes the 'locust capture', in this case the removal of the Rook. When it tries the same King step again, and thus again gets a match with the input move, the Rook is gone, and the Cannon is the closest piece. (And then also removed, and remembered as piece to drop next to the King.)

Easiest way to fix this is to clip the duplicat definition of the 3-step castlings (which luckily happen to be the last two moves of the King) off the move list, by changing a 2 in a 0 (at the start of the commented line). Like

1  1  0  1     3 // king(95)
1  1  1  1     3
1  1  1  0     3
1  1  1 -1     3
1  1  0 -1     3
1  1 -1 -1     3
1  1 -1  0     3
1  1 -1  1     3
2 99  1  0    72
   1  3  0     9
2 99 -1  0    72
   1 -3  0     9
2 99  1  0    72
   1  4  0     9
2 99 -1  0    72
   1 -4  0     9
2 99  1  0   33554504
   1  2  0     9
2 99 -1  0   33554504
   1 -2  0     9
0 99  1  0   33554504 // here a 0 for the number of legs indicates no more moves follow
   1  3  0     9
2 99 -1  0   33554504
   1 -3  0     9
0


Aurelian Florea wrote on Mon, Jun 27, 2022 11:40 AM UTC in reply to H. G. Muller from 08:20 AM:

There is no error now but the short 3 squares castle with the rook still deletes the rook while jumping the cannon over the king!


💡📝H. G. Muller wrote on Mon, Jun 27, 2022 08:20 AM UTC in reply to Aurelian Florea from 05:53 AM:

That is not as it is supposed to be. But since this is one of the moves that we want to outlaw, we don't have to worry about that now. Your test results suggest that the error was caused by #locust being undefined for non-castling, non-e.p. moves, and that the match operator doesn't like having an undefined first operand. Starting the BadZone definition with #locust and intercepts that case before it gets fed to the match operator.

This is the definition that should exactly do what you want, then:

def BadZone #locust and match #locust #partners and cond match #locust #rooks match #dest #rooks match #dest #badCannon =O =dest =locust =D =P;

Aurelian Florea wrote on Mon, Jun 27, 2022 05:53 AM UTC in reply to H. G. Muller from Sun Jun 26 09:06 PM:

None of them gave an error, but with the last one when I tried to castle 3 squares with the rook, the king was in it's proper place but instead of the rook, the cannon was moved by the king and the rook got totally deleted.


💡📝H. G. Muller wrote on Sun, Jun 26, 2022 09:06 PM UTC in reply to Aurelian Florea from 06:25 PM:

Well, GAME-code doesn't excell in clarity of error messages. So we have to figure out what the problem is by trial and error. For this purpose we will start with a very simple definition of BadZone, and gradually increase its complexity to see how far we get. Start with:

def BadZone false =O =dest =locust =D =P;

This should allow everything, including 2-, 3- and 4-step castling with both Cannon and Rook. Then try:

def BadZone #locust =O =dest =locust =D =P;

This should not allow any castling or e.p. capture. Then:

def BadZone #locust and match #locust #partners =O =dest =locust =D =P;

This should now also allow e.p. capture, but all castlings would still be forbidden. Then:

def BadZone #locust and match #locust #partners and match #dest #badCannons =O =dest =locust =D =P;

This should allow everything except 2-step castlings.


Aurelian Florea wrote on Sun, Jun 26, 2022 06:25 PM UTC:

The thing is that I'm getting the same error!


Aurelian Florea wrote on Sun, Jun 26, 2022 05:22 PM UTC in reply to H. G. Muller from 04:12 PM:

Oh, this is not what I meant. I have edited my previous comment.


💡📝H. G. Muller wrote on Sun, Jun 26, 2022 04:12 PM UTC in reply to Aurelian Florea from 03:06 PM:

Yes, isn't that what I wrote in the first place?


Aurelian Florea wrote on Sun, Jun 26, 2022 03:06 PM UTC in reply to H. G. Muller from 11:52 AM:

You mean like this:

set partners (b2 k2 b13 k13 a2 l2 a13 l13); // 'rook' locations for castling

set rooks (b2 k2 b13 k13);

set badCannon (e2 i2 e13 i13);

def BadZone #locust and match #locust #partners and cond match #locust #rooks match #dest rooks match #dest #badCannon =O =dest =locust =D =P;

set zonal true;

?


💡📝H. G. Muller wrote on Sun, Jun 26, 2022 11:52 AM UTC in reply to Aurelian Florea from 10:43 AM:

I see no definition for 'rooks' in the code you posted. It could be that it doesn't like that. Another problem could be the case where 'locust' is 'undefined' (as it might be for most moves). I don'tknow how the match operator handles that. If there still is an error after defining rooks, try to insert an extra

#locust and

Directly after

def BadZone

This might make the code more efficient anyway, because it would never get to the match parts (which might be expensive) for moves other than castling or e.p..


Aurelian Florea wrote on Sun, Jun 26, 2022 10:43 AM UTC in reply to Aurelian Florea from Sat Jun 25 12:53 PM:

With the following code:

set partners (b2 k2 b13 k13 a2 l2 a13 l13); // 'rook' locations for castling set badCannon (e2 i2 e13 i13); def BadZone match #locust #partners and cond match #locust #rooks match #dest rooks match #dest #badCannon =O =dest =locust =D =P; set zonal true;

I'm getting this error:

213 if #zonal 214 verify not fn BadZone #orisqr #destsqr #locustsqr #dropsqr #unload 215 endif

at line 214


💡📝H. G. Muller wrote on Sat, Jun 25, 2022 01:48 PM UTC in reply to Aurelian Florea from 12:53 PM:

I guess you could use the applet-generated code like 2-, 3- or 4-step castling is always possible, with both Rook and Cannon (adding the latter to the 'partners' array). Like it already seems to be. And then supply a function 'BadZone' in GAME code to suppress the two cases you do not want (2-step for Cannon and 4-step for Rook). You would have to set a variable 'zonal' to true in the Pre-Game code to cause this BadZone function to be called.

The function BadZone will get called with 5 parameters: origin, destination, locust square, drop square, and piece to drop on the latter. For castling the castling partner will be on the locust square. I don't think your variants have locust capture other than e.p., so when the locust square is in the 'partners' array you can be sure it is a castling, and there is no need to test whether it was actually a King that was moved.

I would do it as follows:

set rooks (b2 k2 b13 k13);
set badCannon (e2 i2 e13 i13);
def BadZone match #locust #partners and cond match #locust #rooks match #dest rooks match #dest #badCannon =O =dest =locust =D =P;
set zonal true;

This would declare the move invalid when the locust victim is one of the castling partners (match #locust #partners), AND, depending on whether it is one of the Rooks (match #locust #rooks) whether the destination square (of the King) is on the Rook (match #dest #rooks) or whether the destination square is two steps away from the King (match #dest #badCannon).


Aurelian Florea wrote on Sat, Jun 25, 2022 12:53 PM UTC in reply to H. G. Muller from 09:51 AM:

Ok, this means I have to do a separate castling subrountine but that is very difficult, so if you have any advice, I'd gladly take it.


💡📝H. G. Muller wrote on Sat, Jun 25, 2022 09:51 AM UTC in reply to Aurelian Florea from 09:23 AM:

With respect to

In the first preset, when I select the King (after clearing away pieces between King and Rook) it highlights all squares between King and Rook. If I then click the second of that, it does a 2-step castling. I have little doubt that on clicking the 3rd it would do a 3-step castling. If I click on the Rook (which is also highlighted) it does a 4-step castling.


Aurelian Florea wrote on Sat, Jun 25, 2022 09:23 AM UTC in reply to H. G. Muller from 09:18 AM:

Well if I move my king on top of the rook is castles (3 squares king move). What is w.r.t?


💡📝H. G. Muller wrote on Sat, Jun 25, 2022 09:18 AM UTC in reply to Aurelian Florea from Fri Jun 24 10:25 AM:

I am not sure why you refer to 'fast castling'. Is that the type of castling proposed by Kevin Pacey in his wide-board variants? Neither the Diagram nor the GAME-code produced by it do support such castling.

The Cannon would have to be in the partners set to allow castling with it. How far the King moves on castling is defined in the moves of the King; castlings are defined in the legdefs table as two-leg moves, the first leg being the slide that has to be used to find the partner, and the second leg (only attempted when a partner could be reached) indicates the leap the King should make. Your presets appear to define both 2-step and 3-step castlings for the King.

A problem is that the castling moves you define on the King are not critical w.r.t. the partner they use; any piece in the partner set would do. So it would not be possibe to only allow 2-step castling with a Rook, but not with a Cannon.


Aurelian Florea wrote on Fri, Jun 24, 2022 10:25 AM UTC in reply to H. G. Muller from Wed Dec 29 2021 10:00 PM:

@HG,

In these games:

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

castling is supposed to work like described here:

https://www.chessvariants.com/rules/grand-apothecary-chess-alert

https://www.chessvariants.com/rules/grand-apothecary-chess-classic

https://www.chessvariants.com/rules/grand-apothecary-chess-modern

but it does not. It just give fast castling with the rook. I see that this line:

set partners (b2 k2 b13 k13);

should contain the cannons initial position also. That is easy to solve. But I have no idea about the fast castling. May you help me with making the necessary modifications?


💡📝H. G. Muller wrote on Wed, Dec 29, 2021 10:00 PM UTC in reply to Aurelian Florea from 08:43 AM:

Well, actually it doesn't, because I messed up. One should not test pieceType (which will always be 14 at this point), but imi, to decide which moves to forbid. In addition, I tested for a full square, rather than an empty. The following routine should work: it first declares OK all non-imitator moves, all imitations of non-pawns, and all moves to occupied squares. At that point only non-capture pawn imitations are left, and advances of more than 1 rank can be flagged as illegal. finally it tests for e.p. depending on which pawn type is imitated.

    function BadZone(toFile, toRank, pieceType, color, fromFile, fromRank) {
      if(pieceType != 14) return 0;
      if((imi & 511) > 2) return 0;
      if(board[toRank][toFile] & 511) return 0;
      if(fromRank > toRank + 1 || fromRank < toRank - 1) return 1; 
      if(imi == 1) return (toFile != fromFile);
      return (toFile == fromFile);
    }

Aurelian Florea wrote on Wed, Dec 29, 2021 08:43 AM UTC in reply to H. G. Muller from Tue Dec 28 10:34 PM:

It works well, HG, Thank you and a happy new year.


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 10:34 PM UTC in reply to Aurelian Florea from 09:08 PM:

No, ther can be only one function BadZone, which must detect all moves you want to forbid, and return true (non-zero) for those (and false or 0 for the others). So you have to put this in BadZone just before the final return statement (which would otherwise return 'false', because in e.p. capture you only advance one rank)


Aurelian Florea wrote on Tue, Dec 28, 2021 09:08 PM UTC in reply to H. G. Muller from 05:55 PM:

This should be in another function BadZone2 for example, isn't it?


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 05:55 PM UTC in reply to Aurelian Florea from 03:59 PM:

Promotion is done based on the piece type, so if the Joker is not amongst the promotable pieces, it will not promote. Only moves are immitated.

Because you have two different kinds of Pawns the test for it becomes complicated. In any case the destination square must be empty. But then for normal Pawns diagonal moves must be excluded, and for Berolinas the straight moves. So omething like

if(board[toRank][toFile] & 511) {
  if(pieceType == 1) return (toFile != fromFile);
  if(pieceType == 2) return (toFile == fromFile);
}

Aurelian Florea wrote on Tue, Dec 28, 2021 03:59 PM UTC in reply to H. G. Muller from 02:23 PM:

This is done. It works correctly. What about enpassant and promotion?


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 02:23 PM UTC in reply to Aurelian Florea from 01:26 PM:

OK, the problem obviously is that 'imi' is not defined. I am pretty sure I uploaded the version that updates 'imi' also on user moves yesterday, but it turns out the old version was still on the CVP website. So somehow th upload must have failed. I now uploaded it again, and this fixes the problem. You can remove the document... line from the BadZone function now.


Aurelian Florea wrote on Tue, Dec 28, 2021 01:26 PM UTC in reply to H. G. Muller from 01:05 PM:

I get these errors, after a few moves:

BadZone(3,3,1,0,undefined,3) imi =undefined BadZone(3,4,1,0,undefined,3) imi =undefined BadZone(3,5,1,0,undefined,3) imi =undefined BadZone(3,6,1,0,undefined,3) imi =undefined BadZone(3,4,1,0,undefined,3) imi =undefined BadZone(3,5,1,0,undefined,3) imi =undefined BadZone(3,6,1,0,undefined,3) imi =undefined BadZone(1,4,1,0,undefined,1) imi =undefined BadZone(1,5,1,0,undefined,1) imi =undefined BadZone(1,6,1,0,undefined,1) imi =undefined BadZone(4,4,1,0,undefined,4) imi =undefined BadZone(4,5,1,0,undefined,4) imi =undefined BadZone(4,6,1,0,undefined,4) imi =undefined BadZone(7,4,1,0,undefined,7) imi =undefined BadZone(7,5,1,0,undefined,7) imi =undefined BadZone(7,6,1,0,undefined,7) imi =undefined BadZone(8,4,1,0,undefined,8) imi =undefined BadZone(8,5,1,0,undefined,8) imi =undefined BadZone(8,6,1,0,undefined,8) imi =undefined BadZone(10,4,1,0,undefined,10) imi =undefined BadZone(10,5,1,0,undefined,10) imi =undefined BadZone(10,6,1,0,undefined,10) imi =undefined BadZone(5,5,1,0,undefined,5) imi =undefined BadZone(5,6,1,0,undefined,5) imi =undefined BadZone(6,5,1,0,undefined,6) imi =undefined BadZone(6,6,1,0,undefined,6) imi =undefined BadZone(3,3,0,0,undefined,3) imi =1073741825 BadZone(3,6,1,0,undefined,3) imi =1073741825 BadZone(5,9,1,1024,undefined,5) imi =1073741825 BadZone(5,8,1,1024,undefined,5) imi =1073741825 BadZone(5,7,1,1024,undefined,5) imi =1073741825 BadZone(5,8,1,1024,undefined,5) imi =1073741825 BadZone(5,7,1,1024,undefined,5) imi =1073741825 BadZone(6,8,1,1024,undefined,6) imi =1073741825 BadZone(6,7,1,1024,undefined,6) imi =1073741825 BadZone(1,9,1,1024,undefined,1) imi =1073741825 BadZone(1,8,1,1024,undefined,1) imi =1073741825 BadZone(1,7,1,1024,undefined,1) imi =1073741825 BadZone(3,9,1,1024,undefined,3) imi =1073741825 BadZone(3,8,1,1024,undefined,3) imi =1073741825 BadZone(3,7,1,1024,undefined,3) imi =1073741825 BadZone(4,9,1,1024,undefined,4) imi =1073741825 BadZone(4,8,1,1024,undefined,4) imi =1073741825 BadZone(4,7,1,1024,undefined,4) imi =1073741825 BadZone(7,9,1,1024,undefined,7) imi =1073741825 BadZone(7,8,1,1024,undefined,7) imi =1073741825 BadZone(7,7,1,1024,undefined,7) imi =1073741825 BadZone(8,9,1,1024,undefined,8) imi =1073741825 BadZone(8,8,1,1024,undefined,8) imi =1073741825 BadZone(8,7,1,1024,undefined,8) imi =1073741825 BadZone(10,9,1,1024,undefined,10) imi =1073741825 BadZone(10,8,1,1024,undefined,10) imi =1073741825 BadZone(10,7,1,1024,undefined,10) imi =1073741825 BadZone(5,7,1,0,undefined,5) imi =1073742849 BadZone(5,9,0,0,undefined,5) imi =1073742849 BadZone(4,3,1,0,undefined,4) imi =1073742849 BadZone(4,4,1,0,undefined,4) imi =1073742849 BadZone(4,5,1,0,undefined,4) imi =1073742849 BadZone(4,6,1,0,undefined,4) imi =1073742849 BadZone(4,4,1,0,undefined,4) imi =1073742849 BadZone(4,5,1,0,undefined,4) imi =1073742849 BadZone(4,6,1,0,undefined,4) imi =1073742849 BadZone(1,4,1,0,undefined,1) imi =1073742849 BadZone(1,5,1,0,undefined,1) imi =1073742849 BadZone(1,6,1,0,undefined,1) imi =1073742849 BadZone(7,4,1,0,undefined,7) imi =1073742849 BadZone(7,5,1,0,undefined,7) imi =1073742849 BadZone(7,6,1,0,undefined,7) imi =1073742849 BadZone(8,4,1,0,undefined,8) imi =1073742849 BadZone(8,5,1,0,undefined,8) imi =1073742849 BadZone(8,6,1,0,undefined,8) imi =1073742849 BadZone(10,4,1,0,undefined,10) imi =1073742849 BadZone(10,5,1,0,undefined,10) imi =1073742849 BadZone(10,6,1,0,undefined,10) imi =1073742849 BadZone(5,5,1,0,undefined,5) imi =1073742849 BadZone(5,6,1,0,undefined,5) imi =1073742849 BadZone(6,5,1,0,undefined,6) imi =1073742849 BadZone(6,6,1,0,undefined,6) imi =1073742849 BadZone(3,7,1,0,undefined,3) imi =1073742849 BadZone(4,3,0,0,undefined,4) imi =1073741825 BadZone(4,6,1,0,undefined,4) imi =1073741825 BadZone(6,9,1,1024,undefined,6) imi =1073741825 BadZone(6,8,1,1024,undefined,6) imi =1073741825 BadZone(6,7,1,1024,undefined,6) imi =1073741825 BadZone(6,8,1,1024,undefined,6) imi =1073741825 BadZone(6,7,1,1024,undefined,6) imi =1073741825 BadZone(5,6,1,1024,undefined,5) imi =1073741825 BadZone(4,6,1,1024,undefined,4) imi =1073741825 BadZone(1,9,1,1024,undefined,1) imi =1073741825 BadZone(1,8,1,1024,undefined,1) imi =1073741825 BadZone(1,7,1,1024,undefined,1) imi =1073741825 BadZone(3,9,1,1024,undefined,3) imi =1073741825 BadZone(3,8,1,1024,undefined,3) imi =1073741825 BadZone(3,7,1,1024,undefined,3) imi =1073741825 BadZone(4,9,1,1024,undefined,4) imi =1073741825 BadZone(4,8,1,1024,undefined,4) imi =1073741825 BadZone(4,7,1,1024,undefined,4) imi =1073741825 BadZone(5,9,1,1024,undefined,5) imi =1073741825 BadZone(5,8,1,1024,undefined,5) imi =1073741825 BadZone(7,9,1,1024,undefined,7) imi =1073741825 BadZone(7,8,1,1024,undefined,7) imi =1073741825 BadZone(7,7,1,1024,undefined,7) imi =1073741825 BadZone(8,9,1,1024,undefined,8) imi =1073741825 BadZone(8,8,1,1024,undefined,8) imi =1073741825 BadZone(8,7,1,1024,undefined,8) imi =1073741825 BadZone(10,9,1,1024,undefined,10) imi =1073741825 BadZone(10,8,1,1024,undefined,10) imi =1073741825 BadZone(10,7,1,1024,undefined,10) imi =1073741825 BadZone(6,7,1,0,undefined,6) imi =1073742849 BadZone(6,9,0,0,undefined,6) imi =1073742849 BadZone(4,2,8,0,undefined,4) imi =1073742849 BadZone(4,5,8,0,undefined,4) imi =1073742849 BadZone(3,3,8,0,undefined,3) imi =1073742849 BadZone(4,4,8,0,undefined,4) imi =1073742849 BadZone(4,5,8,0,undefined,4) imi =1073742849 BadZone(3,3,8,0,undefined,3) imi =1073742849 BadZone(4,4,8,0,undefined,4) imi =1073742849 BadZone(7,5,8,0,undefined,7) imi =1073742849 BadZone(7,4,8,0,undefined,7) imi =1073742849 BadZone(4,2,0,0,undefined,4) imi =1073741832 BadZone(4,5,8,0,undefined,4) imi =1073741832 BadZone(5,10,1,1024,undefined,5) imi =1073741832 BadZone(5,9,1,1024,undefined,5) imi =1073741832 BadZone(5,8,1,1024,undefined,5) imi =1073741832 BadZone(5,9,1,1024,undefined,5) imi =1073741832 BadZone(5,8,1,1024,undefined,5) imi =1073741832 BadZone(5,6,1,1024,undefined,5) imi =1073741832 BadZone(4,6,1,1024,undefined,4) imi =1073741832 BadZone(6,6,1,1024,undefined,6) imi =1073741832 BadZone(1,9,1,1024,undefined,1) imi =1073741832 BadZone(1,8,1,1024,undefined,1) imi =1073741832 BadZone(1,7,1,1024,undefined,1) imi =1073741832 BadZone(3,9,1,1024,undefined,3) imi =1073741832 BadZone(3,8,1,1024,undefined,3) imi =1073741832 BadZone(3,7,1,1024,undefined,3) imi =1073741832 BadZone(4,9,1,1024,undefined,4) imi =1073741832 BadZone(4,8,1,1024,undefined,4) imi =1073741832 BadZone(4,7,1,1024,undefined,4) imi =1073741832 BadZone(6,9,1,1024,undefined,6) imi =1073741832 BadZone(6,8,1,1024,undefined,6) imi =1073741832 BadZone(7,9,1,1024,undefined,7) imi =1073741832 BadZone(7,8,1,1024,undefined,7) imi =1073741832 BadZone(7,7,1,1024,undefined,7) imi =1073741832 BadZone(8,9,1,1024,undefined,8) imi =1073741832 BadZone(8,8,1,1024,undefined,8) imi =1073741832 BadZone(8,7,1,1024,undefined,8) imi =1073741832 BadZone(10,9,1,1024,undefined,10) imi =1073741832 BadZone(10,8,1,1024,undefined,10) imi =1073741832 BadZone(10,7,1,1024,undefined,10) imi =1073741832 BadZone(5,8,1,0,undefined,5) imi =1073742849 BadZone(5,10,0,0,undefined,5) imi =1073742849 BadZone(4,1,18,0,undefined,4) imi =1073742849 BadZone(3,3,18,0,undefined,3) imi =1073742849 BadZone(2,5,18,0,undefined,2) imi =1073742849 BadZone(1,7,18,0,undefined,1) imi =1073742849 BadZone(0,9,18,0,undefined,0) imi =1073742849 BadZone(3,3,18,0,undefined,3) imi =1073742849 BadZone(2,5,18,0,undefined,2) imi =1073742849 BadZone(1,7,18,0,undefined,1) imi =1073742849 BadZone(0,9,18,0,undefined,0) imi =1073742849 BadZone(4,1,0,0,undefined,4) imi =1073741842 BadZone(1,7,18,0,undefined,1) imi =1073741842 BadZone(6,10,1,1024,undefined,6) imi =1073741842 BadZone(6,9,1,1024,undefined,6) imi =1073741842 BadZone(6,8,1,1024,undefined,6) imi =1073741842 BadZone(6,9,1,1024,undefined,6) imi =1073741842 BadZone(6,8,1,1024,undefined,6) imi =1073741842 BadZone(5,6,1,1024,undefined,5) imi =1073741842 BadZone(4,6,1,1024,undefined,4) imi =1073741842 BadZone(6,6,1,1024,undefined,6) imi =1073741842 BadZone(1,9,1,1024,undefined,1) imi =1073741842 BadZone(1,8,1,1024,undefined,1) imi =1073741842 BadZone(3,9,1,1024,undefined,3) imi =1073741842 BadZone(3,8,1,1024,undefined,3) imi =1073741842 BadZone(3,7,1,1024,undefined,3) imi =1073741842 BadZone(4,9,1,1024,undefined,4) imi =1073741842 BadZone(4,8,1,1024,undefined,4) imi =1073741842 BadZone(4,7,1,1024,undefined,4) imi =1073741842 BadZone(7,9,1,1024,undefined,7) imi =1073741842 BadZone(7,8,1,1024,undefined,7) imi =1073741842 BadZone(7,7,1,1024,undefined,7) imi =1073741842 BadZone(8,9,1,1024,undefined,8) imi =1073741842 BadZone(8,8,1,1024,undefined,8) imi =1073741842 BadZone(8,7,1,1024,undefined,8) imi =1073741842 BadZone(10,9,1,1024,undefined,10) imi =1073741842 BadZone(10,8,1,1024,undefined,10) imi =1073741842 BadZone(10,7,1,1024,undefined,10) imi =1073741842 BadZone(6,8,1,0,undefined,6) imi =1073742849 BadZone(6,10,0,0,undefined,6) imi =1073742849 BadZone(4,0,14,0,undefined,4) imi =1073742849 BadZone(4,1,14,0,undefined,4) imi =1073742849 BadZone(4,2,14,0,undefined,4) imi =1073742849 BadZone(4,3,14,0,undefined,4) imi =1073742849 BadZone(4,4,14,0,undefined,4) imi =1073742849


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 01:05 PM UTC in reply to Aurelian Florea from 12:52 PM:

OK, so the routine is in fact called. Try the following. Below the script add a place where we can print debug output:

<p id="debug"></p>

Then inside the BadZone routine add a line

document.getElementById("debug").innerHTML += 'BadZone(' + toFile + ',' + toRank + ',' + pieceType + ',' + color + ',' + fromFile + ',' + toFile + ') imi =' + imi + '<br>';

Then we can get an impression of what goes wrong.

 


Aurelian Florea wrote on Tue, Dec 28, 2021 01:00 PM UTC in reply to H. G. Muller from 12:34 PM:

Is there a mail of yours where I can send my password to you, so you can work on it? Then after you are done I just change the password.


Aurelian Florea wrote on Tue, Dec 28, 2021 12:52 PM UTC in reply to H. G. Muller from 12:34 PM:

When I had put return 1 all moves where indeed suppressed.


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 12:34 PM UTC in reply to Aurelian Florea from 09:58 AM:

I can confirm that the BadZone function has no effect in the page at the link you gave. The weird thing is that when I ask the page source of that page, copy the Diagram in it to a local HTML page on my own computer, and open it in the browser, the distant moves do get suppressed. I have no idea why it doesn't work on your page. If I look in the browser console I do not get any error messages from the JavaScript on your page.

The problem is that I cannot experiment on your page; only you have access to it. This is why I copied to my own computer, but the copy shows no errors, so there is nothing to debug. Perhaps you can try the following: add as a first line in the BadZone routine the line

return 1;

This should suppress every move of every piece, and even prevent the highlighting of the piece itself. If that has no effect, I am pretty sure that the routine BadZone never gets called.


Aurelian Florea wrote on Tue, Dec 28, 2021 09:58 AM UTC in reply to H. G. Muller from 09:06 AM:

The longer moves are still shown. I'm not sure if the ai internally makes only 1 step moves. The enpassant and promotion rights are probably still there needing more BadZone functions, probably.

Also all these things should be done manually in the game courier generated script. Isn't that true?


💡📝H. G. Muller wrote on Tue, Dec 28, 2021 09:06 AM UTC in reply to Aurelian Florea from 07:02 AM:

OK, I found the problem. It turns out that the variable 'imi' was copied directly from the board, where it also contains color and highlighting information, besides the piece type. So these bits have to be stripped first by taking (imi & 511) to be left with the type. I suppose I should change the Diagram script to already do this by itself when storing imi, rather than when using it. For now you can fix it by using

  <script>
    function BadZone(toFile, toRank, pieceType, color, fromFile, fromRank) {
      if(pieceType != 14) return 0;
      if((imi & 511) > 2) return 0;
      return (fromRank > toRank + 1 || fromRank < toRank - 1);
    }
  </script>

This also fixes the problem that the highlighting function is also called to highlight the selected piece itself (so that fromRank equals toRank), and we don't want to suppress that. So I changed the test for suppressing only moves of more than 1 rank.

Note that it still wouldbe able to e.p. capture when imitating a pawn.


💡📝H. G. Muller wrote on Mon, Dec 27, 2021 10:22 PM UTC in reply to Aurelian Florea from 06:25 PM:

Well, that looks OK. If you would post a link to the page where you have it, I could have a look at it, and maybe we could have some progress...


Aurelian Florea wrote on Mon, Dec 27, 2021 06:25 PM UTC in reply to H. G. Muller from 06:00 PM:

I have the following script, without any result:

function BadZone(toFile, toRank, pieceType, color, fromFile, fromRank) { if(pieceType != 14) return 0; if(imi != 1 && imi != 2) return 0; return (fromRank != (color ? toRank + 1 : toRank - 1)); }


💡📝H. G. Muller wrote on Mon, Dec 27, 2021 06:00 PM UTC in reply to Aurelian Florea from 03:40 PM:

No, it does not. It is not in the table. (In fact the Diagram uses piece type = 250 for holes internally.) The Diagram should be put on the HTML page that contains the Diagram. It should not matter where. There is no way to relate the script to a specific Diagram, however. So if there are more than a single Diagram on the same page, they will all use the BadZone function defined in the script.


Aurelian Florea wrote on Mon, Dec 27, 2021 03:40 PM UTC in reply to H. G. Muller from 01:45 PM:

I could not figure out where to put the bad zone script. It does not work yet it seems, even if with the proper modifications. Another thing that I am in doubt is if the hole piece count towards piece number. I assumed it does!


Aurelian Florea wrote on Mon, Dec 27, 2021 02:57 PM UTC in reply to H. G. Muller from 01:45 PM:

Wow H.G.,

Thanks!

I thought that was it!


💡📝H. G. Muller wrote on Mon, Dec 27, 2021 01:45 PM UTC in reply to Aurelian Florea from 04:17 AM:

Well, the idea was not to change any piece types, but detect whether the generated move was for an imitator imitating a pawn, and in that case forbid the move (by returning a non-zero value) when it advanced more than one rank. This was not so easy, though, because BadZone did not get the coordinates of the origin square passed to it, and it was not obvious what the imitator was imitating.

I did change the Diagram script now to make this easier: the variable 'imi' now contains the imitated piece at all times during the game, not just when the AI is thinking. And the square of origin are passed as extra parameters to BadZone. (Refresh the browser cache!) This should make the following script so what you want:

<script>
function BadZone(toFile, toRank, pieceType, color, fromFile, fromRank) {
  if(pieceType != NUMBER_OF_JOKER) return 0;
  if(imi != NUMBER_OF_PAWN) return 0;
  return (fromRank != (color ? toRank + 1 : toRank - 1));
}
</script>

(Replace the NUMBER_OF_... by the actual numbers your pieces have in your table.)


Aurelian Florea wrote on Mon, Dec 27, 2021 04:17 AM UTC in reply to H. G. Muller from Sun Dec 26 09:39 PM:

HG, I don't understand the bad zone script. How it would work. The way I see it the specific instructions to be added here would be something like: if lastMoved is pawn then imitate barren pawn. if lastMoved is berolina then imitate barren berolina.

The barren pieces pieces could be added in the diagram but not used in the initial setup.

But I don't think the interactive diagram supports lastMoved as the game courier supports it. It seems I'm screwed with this one!


Greg Strong wrote on Mon, Dec 27, 2021 02:55 AM UTC in reply to H. G. Muller from Sun Dec 26 09:39 PM:

The Diagram does not support 'partial imitators', which can only imitate a subset of the pieces, or of the moves of some of the pieces. I suppose it would be possible to exploit the possibility to veto unwanted moves through a user-supplied JavaScript function BadZone.

I had to do something similar to this to get it working in ChessV.  A basic imitator rule will, of course, imitate all moves.  It requires extra code to stop it from imitating this.  Also, the Joker imitating a pawn cannot capture en passant even if a pawn could do so.  Fortunately, this did not require extra code for me just because of the way en passant is implemented as a rule and not a movement capability.


💡📝H. G. Muller wrote on Sun, Dec 26, 2021 09:39 PM UTC in reply to Aurelian Florea from 06:19 PM:

The Diagram does not support 'partial imitators', which can only imitate a subset of the pieces, or of the moves of some of the pieces. I suppose it would be possible to exploit the possibility to veto unwanted moves through a user-supplied JavaScript function BadZone. Originally this feature was created for confining pieces to part of the board as  in Xiangqi. It could be used to veto moves for any reason, though. Problem in this case is that the routine should know which piece the imitator is imitating, because you don't want to veto distant forward moves when it is imitating a Rook. The Diagram keeps track of that in a variable that is accessible from the routine. But it is a different variable in case of a move in the game from when the AI is thinking.


Aurelian Florea wrote on Sun, Dec 26, 2021 06:19 PM UTC:

Hello HG, While testing the interactive diagram on grand apothecary chess alert I have noticed that the joker imitating a berolina pawn has moved 5 spaces. This is probably because the berolina pawn is defined like this mfF*fceW and that means the joker inherited the ability to move as much as to the center of the board. But the rules of the games, as I had made them state : "A joker imitating a pawn has only the regular moves, no double step, no enpassant and no promotion even if that pawn has promoted the last move."

In the game courier I had created a special case for when the joker imitates a pawn to get the moves of a fictious barren pawn that does not promote, and gets no double steps or en passat. But I don't think that can be done here. Can it?

Here is the game that led to this situation:

{770295349} 1. f7 Xi8 2. e6 Wb10 3. d5 Wk10 4. Bd4 Ig9 5. g7 h9 6. f8 Ii7 7. Gi5 Ik9 8. f6 Uk8 9. Me4 Ig6 10. Mf4 Gd9 11. Of3 Id10 12. Wf5 Oj9 13. Wig5 Fb9 14. Xe7 Ji10

Grand Apothecary chess alert can be found here:

https://www.chessvariants.com/rules/grand-apothecary-chess-alert


100 comments displayed

LatestLater Reverse Order EarlierEarliest

Permalink to the exact comments currently displayed.