For some reason this does not work anymore. The I.D. on the Eurasian Chess page also lost its background, and I am sure this worked before. Is there some global style definition now that gives
elements a background color?
Looking at it with Web Developer Tools in Firefox, I see that TABLE TR has the background-color value of var(--nav-bgcolor), and when I turn it off, the background image shows up. With that in mind, I added this to the Eurasian Chess page, and that fixed it:
The comment contains the board image twice, the second time as a plain image below the Diagram (which works), the first time as background-image to the <table> element that contains the board squares as cells. The background of these cells is then set to transparent.
For some reason this does not work anymore. The I.D. on the Eurasian Chess page also lost its background, and I am sure this worked before. Is there some global style definition now that gives <tr> elements a background color? These are the only elements between the <td> and the <table>. A background color of the table would be displayed behind the background-image.
The reliable method would try out all pseudo-legal moves, and then generate opponent moves in each of the resulting positions, to see if any of those captures the King. All opponent moves will have to be tried to conclude the move is legal (which usually is the case), and on a large variant this can take very long (to the point where GC aborts the GAME-code execution).
Thanks to GAME Code being an interpreted language written in another interpreted language, it is not as quick at things compiled languages would do more quickly, and it will sometimes exceed the time limit that PHP imposes on script execution. This makes optimizations and short cuts more important, and in hand-written code, I have done this. See my previous comment about how I handled the spotting of check in Ultima as an example.
In automatically-generated code, it might be harder to get in the optimizations needed for particular games. So I would suggest a compromise between your quick method and your reliable method. Flag pieces that can capture a piece without moving to its space, and use your reliable method on these while just checking if other pieces can move to the King's space.
This isn't showing up well on any browser or OS I've seen it on. On my iPad, I see the arrowed board both above and below the blank 7x8 board with the pieces, and the one above is tiled. On Android and Windows, the tiled board is not appearing at the top, but the pieces are still not appearing on the same board as the arrows.
OK, I see. The betza.txt code actually does say 'check'. Problem was that by searching for 'say check' I did not find that, because there are quotes around the word 'check'.
It appears that it would only ever say 'check!' when the preset is using the accelerated method for testing legality of highlighted moves. This is the default method, because it is faster. But it is not entirely reliable. The reliable method would try out all pseudo-legal moves, and then generate opponent moves in each of the resulting positions, to see if any of those captures the King. All opponent moves will have to be tried to conclude the move is legal (which usually is the case), and on a large variant this can take very long (to the point where GC aborts the GAME-code execution). And in that branch of teh code it would never say 'check!'.
In the accelerated test it would generate the opponent moves not after the move that has to be tested for legality, but before it. (Meaning that it has to do it only once.) If any of those hit the King, the move that was just made apparently delivers check. After a move considered for highlighting it then only retries such an existing checking move, to see if the check was resolved, and all moves that hit squares mutated by the move-to-be-highlighted (which could have been discovered, and now hit the King). That is a huge time saver.
Where it goes wrong is that during this accelerated check test it actually removes the King, and tests whether it was in check by testing whether a move that hits the square it was on is capture capable. This to avoid a slider check is blocked by the King, making the square behind it to be safe to move to. King moves can then be tested for legality simply by testing whether their destination was marked as attacked. But this procedure does not mark squares that are attacked by locust capture. Such as an Advancer does.
You did not get the point. Does the preset say 'check' when you check with any other piece than an Advancer? I think it doesn't. So then this has nothing to do with the piece being an Advancer.
I dug back into this thread to find the preset he was talking about. He linked to a particular game in which neither Advancer checked the opponent's King. Continuing this game by choosing Annotate and then Move, I played some moves to get a White Flying Dragon to check the Black King, and when I did, it said "check!". After moving the King out of check, I tried to move White's Advancer, but no legal moves are being highlighted on the board for it. However, its legal moves do show up in the Moves field, and when I tried one, it worked. At the top of the Moves field, I see the legal move "A e1-#to; A #to-b1". I think this is not a properly formatted move, and it may be interfering with the ability to recognize the Advancer's legal moves. Also, when I entered it, it did not recognize it as legal, and it gave the error message "#to is not a valid square".
Here are the moves to the position in question so that you can see what's going on.
1. P f2-f5
1... p f9-f6
2. P e2-e4
2... p e9-e7
3. F i1-h3
3... f i10-h8
4. P i2-i3
4... p d9-d8
5. B h1-i2
5... c g10-f7
6. C d1-f3
6... f b10-c8
7. C g1-e3
7... c d10-f8
8. K f1-i1
8... p g9-g7
9. P b2-b3
9... c f8-e5
10. P d2-d4
10... c e5-f8
11. B c1-b2
11... a e10-h7
12. F b1-e2
12... p i9-i8
13. P g2-g5
13... c f7-e8
14. P g5-g6
14... a h7-f9
15. P c2-c4
15... p b9-b6
16. F h3-g2
16... c e8-d7
17. P d4-d5
17... f c8-d6
18. F e2-h3
18... p c9-c7
19. C f3-e6
19... c d7-e6
20. P d5-e6
20... p j9-j8
21. B b2-a3
21... b c10-a8
22. B a3-d6
22... p e7-d6
23. R h1-f1
23... p j8-j7
24. F g2-d3
24... b h10-j8
25. C e3-g1
25... f h8-i6
26. P j2-j3
26... p d8-d7
27. P a2-a5
27... p b6-a5
28. R a1-a5
28... b a8-b9
29. P e6-d7
29... f9-e8;@-d7
30. C g1-a7
30... f i6-h4
31. C a7-d8 // - check! -
31... k f10-f9
Just click on Annotate for Butterfly Chess and paste these in to see the same position.
Can someone suggest an example where the capture matrix is used?
Minjiku Shogi, Makromachy. For Golem Chess I described how it could be done in the Comments. (At that time I had already made an I.D. in the old way, uses a WeirdPromotion custom script.)