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 Earliest Comments Only For Pages | Games | Rated Pages | Rated Games | Subjects of Discussion ]

Comments by HGMuller

EarliestEarlier Reverse Order LaterLatest
Chu Shogi. Historic Japanese favorite, featuring a multi-capturing Lion. (12x12, Cells: 144) (Recognized!)[All Comments] [Add Comment or Rating]
📝H. G. Muller wrote on Fri, Jun 12, 2020 11:22 AM EDT:

For me it plays BT-g10 instead of Lnxe7. Your browser must be using an old cached script.

BTW, I sort of patched the counter-strike problem now, by paying more attention to what the lastest move was when invoking the AI, and making it aware of a preceding non-Lion x Lion when I set it thinking. This too isn't perfect yet. (It would miss a locust capture of the Lion by a Falcon or Eagle.) But for now it should do.

The point is that I want to replace the entire old move-entry system of the diagram, which had a move generator that directly highlighted squares, in interaction with what already had been clicked, by one based on the new move generator in the AI. The latter just generates a list of all moves, complete with all side effects. And because it can search ahead, it will be able to judge even the more complex legality conditions perfectly. The highlighting during move entry should then be based on that list, and the moves would automaticaly be in AI format, so that they can be fed back into it when it goes thinking for a reply. So it would be a bit of a waste to spend too much time patching up the old system for better interaction with the AI.


Betza notation (extended). The powerful XBetza extension to Betza's funny notation.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Fri, Jun 12, 2020 01:07 PM EDT:

I did a complete write-up on XBetza recently, and submitted it to CVP as an article. It also contains an updated copy of the 'Betza sandbox'. But it isn't approved by the editors yet.

satellite=joker files=9 ranks=8 graphicsDir=/graphics.dir/alfaerie/ whitePrefix=w blackPrefix=b graphicsType=gif squareSize=50 useMarkers=1 maxPromote=1 promoChoice=QNRBJ symmetry=mirror pawn::::a2-i2 knight:N:::b1,h1 bishop::::c1,f1 rook::::a1,i1 queen::::d1 joker::fI:fool:g1 king::::e1

This is demo featuring a Joker. I see now that the pure I atom describes a bi-directional Joker, which imitates both the piece and its 180-degrees flipped version. This was not my original intention. But perhaps it is just as well, as without directional modifiers Betza atoms always move in all directions, and it would be ugly if I was an exception. So I changed the definition of the Joker in the diagram above to fI, so that it only imitates the Pawn moves as if they were Pawns of its own color.


Chu Shogi. Historic Japanese favorite, featuring a multi-capturing Lion. (12x12, Cells: 144) (Recognized!)[All Comments] [Add Comment or Rating]
📝H. G. Muller wrote on Fri, Jun 12, 2020 02:25 PM EDT:

Capture bridges now also work. The anti-trading rules in Chu Shogi are so complex because they are applied to a piece capable of double capture, so that a trade could be accompanied by a sizable material gain, and they did not want to outlaw that. The same could in principle happen when several piece types of unequal value are subject to this rule. (As is the case in Tengu Dai Shogi, where Lion and Lion Dog can also not capture each other when they are protected.)

I solved it by specifying a value threshold, and when the combined gain of the capture is larger than the value of the capturer plus this threshold it can be made safely. Because the piece values are only known to the diagram, the option to specify this is tradeThreshold=N, where N is the number of the most-valuable piece that can not act as a capture bridge. So in this case I specified N=2, as the GB was defined as the second piece.

This appears to work, as can be easily tested by dragging a white Lion to i6 and a black one to g7, switch the AI on, and then drag various white pieces to h6 (and then take back 2 moves for the next try). For every piece black should then play Lnxh6xi6, except for P and GB, where it will play something else.


Betza notation (extended). The powerful XBetza extension to Betza's funny notation.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Fri, Jun 12, 2020 03:40 PM EDT:

It should not. That is a feature for Musketeer-type gating. Earlier today I had uploaded a buggy version, which switched that on by default, instead of only with the option autoGate=1. But it has long since been replaced. It seems you are still using an old version of the script. What happens when you click on the 'move' header in the piece table?


💡📝H. G. Muller wrote on Fri, Jun 12, 2020 06:31 PM EDT:

Is mp something different than the moving and hopping modifiers combined? Does mpafsK mean the same as N? If so, how does it work?

I now elaborated on that, and hope this will make it clear.

I don't follow what the x modifer does. An example would be helpful.

I think we have to discuss presentation strategy here. The list of modifiers below the diagram also serves the purpose of a quick reference guide, which can always be kept in view by people who are using the sandbox diagram. Elaborating on each of them, explaining examples, would easily quadruple its size, so that it becomes difficult to use for that purpose. I do in fact give an example for x, (mNxaN) but I don't say what it is. (It is in fact the Knight of Knight-Relay Chess, which moves (without capturing) like a Knight (mN) and induces Knight moves at a distance of a Knight move (xaN)).

Would it be an idea to add an extra section where each of the examples mentioned in the 'quick reference' are discussed in depth?

It's not clear how FyafsF is supposed to describe the Griffon. Should the second F be an R?

Did you read the 'more about a' link in the 'quick reference'? It opens a box that should make this clear. I presented it this way, because most people wanting to use XBetza (e.g. for making an Interactive Diagram for their variant) would not need the complexity of multi-leg moves, and be completely satisfied by combining Knights with Bishops, or perhaps make a HFD. Even the need for directional modifiers is quite rare (outside Shogi). Not many people use bent riders, bent lame leapes, locusts, bifurcators, pieces that induce moves in other pieces, or displace those...

I don't want to burden the 95% of people with stuff they don't need, and deter them by it. The a is a highly advanced feature of XBetza, almost never needed.

But it would of course be bad if I hid it so well that people will miss it alltogether. The more-about-a box was actually a remnant of the old sandbox diagram I posted as a comment to the Betza article (since then pushed far in the background noise). In a real article I have more space, and perhaps I should move most of what is now in the box to the preceding section about XBetza above the sandbox, or a new section about multi-leg moves. (With an initial warning that people who just want to do basic things can skip that section.)

To answer your question: The yafsF part of FyafsF means the move starts as F to an empty square, to fork there (y is "move and continue as slider"), and then continue in the (relative) fs direction, i.e. as a Rook. That is a Griffon, except for the F moves. (Because a Rook makes at least one step; it cannot null-move.) So the latter are slammed on separately.

I'm not familiar with Bifurcators, and other readers might not be too. An illustration to how the piece works or a link to a page on this type of piece would be helpful before describing what gabyabsR  is doing.

Bifurcators are an invention of Mats Winther. But when I looked for them, I could not find any mention of them in the Piececlopedia. (Do we have a search function here?) I know Mats describes many variants on his own website, mostly based on very innovative piece designs ('Catapults' are another invention of him).

Note, however, that the sandbox diagram is available as an interpretation aid: to know what it means you only have to copy-paste it in the Betza move-entry, assign it to a piece, (e.g. 'betza2'), and then click on the name of that piece to summon up the move diagram. As this is some kind of hopper, even the move diagram will be interactive for pointing out the hopper's mount by hovering the mouse pointer over a square in its path (or touching that square on a touch-screen device). That would make it obvious what the piece does; as they say, a picture is worth a thousand words.

One reason for giving the examples was to provide people with something to try out the sandbox diagram with something non-obvious.

[Edit] I now added a section at the end, which discusses the examples of the more complex pieces in detail.


💡📝H. G. Muller wrote on Sat, Jun 13, 2020 02:48 AM EDT:

Problem is that it still assigns zero value to the Joker, because it determines piece values at the start of the game, when the Joker has no moves yet. Not sure how to put a value on it; it seems to depend a lot on what the opponent has. So some sort of average of the opponent piece values. But it should be a weighted average, as stronger pieces tend to move more frequently than weaker pieces. And of course it should be weighted by the number of each type the opponent has as well. So something like SUM(over pieces) value*value/SUM(over pieces)value.


💡📝H. G. Muller wrote on Sat, Jun 13, 2020 05:00 AM EDT:

OK, I just uploaded an updated script that fixes that.


💡📝H. G. Muller wrote on Sat, Jun 13, 2020 07:20 AM EDT:

I did post an Interactive Diagram for Gross Chess. You can simply look up that comment, click 'View' to see it in isolation, and then ask your browser for the 'page source' to see the HTML. Then you will see the diagram definition between the <div> tags and the supporting JavaScript for handling the special promotion rule between <script> tags. You can just copy that JavaScript. You might have to adapt the numbers a bit to bring it in accordance with what promotions you want to allow where, but that should be easy, as it is a very straightforward routine. Programming in JavaScript is a hundred times easier than writing 'game code'...

As to the shuffling: you would have to tell me by which rules you want to shuffle.


Chu Shogi. Historic Japanese favorite, featuring a multi-capturing Lion. (12x12, Cells: 144) (Recognized!)[All Comments] [Add Comment or Rating]
📝H. G. Muller wrote on Sat, Jun 13, 2020 10:25 AM EDT:

Yes, of course it is very weak. It searches only 2 ply, and that isn't even enough to see a mate-in-1 threat coming. You can switch it to 3 ply, but in a game as large as Chu Shogi that would probably already make it think too long. This is JavaScript, not a C program!

I am sure I could make a search that plays much stronger with the same number of nodes. I put this one together in two days. But that is not meant as an excuse: I intend this thing to be weak.  It is meant to be a demo for people that have never played the game before, and visit the page the diagram is on to learn about its rules, so they can have a sparring partner to get a whif of how the rules work out in practice.

Also note that it doesn't use any variant-specific knowledge other than the rules. It has to guess the piece values itself, and I am amazed of how reasonable these guesses appear to be. I made a version that also tries to weight in promotability, by making some weighted average of the values of base piece and promoted form, where the weight of the latter increases with the ease of its promotion and the relative gain of intrinsic value. That also looks reasonable, except that the current algorithm then puts an unexpectedly high value on the Lance. It seems this has the most favorable prospects for promotion, so that it assumes you would do your best to preserve it until it can actually promote, rather than lose it in tactics to clear the way for others. (Of course it doesn't realize the Lance is file bound, so that you really don't have much choice in the matter...). But now that I think about it, perhaps this is not such a silly thought. The Lance itself is pretty useless in combat, can reach the zone in a single move when the time comes, and a White Horse is one of the more valuable pieces.


📝H. G. Muller wrote on Sat, Jun 13, 2020 10:58 AM EDT:

Well, it estimates about 450 for both Kirin and Lance! (to compare: 480 for Bishop.) It differs a bit each time, as the estimation process involves random sampling.


Betza notation (extended). The powerful XBetza extension to Betza's funny notation.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Sat, Jun 13, 2020 11:45 AM EDT:

Oh, that rule is a standard feature of the diagram. You can also see that in the definition of the Gross Chess diagram itself. You just prefix the piece ID in the promoChoice setting with an asterisk (*). (Must still make the AI understand that, though.) Choices that cannot be made on last rank (like staying a Pawn) can be prefixed with an exclamation point (!). So you don't have to worry about that in WeirdPromotion(). The problem is that the way the diagram works it would offer all pieces mentioned in promoChoice that are available for the user to promote to, irrespective of what rank in the zone you are on. So the task of WeirPromotion is just to reject the choices that are not allowed according to the specific promotion rules, and I think the version there does that by considering them the choice to not promote at all. By replacing the choice by a Pawn, as if the user had chosen that. On the last rank, where a Pawn would not be allowed, this can never happen, as every other choice would be allowed there.) I think in newer versions of the Diagram script WeirPromotion() can actually cause the Diagram to refuse the move completely (rather than just the promotion), by returning 1022 as choice.


Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Sat, Jun 13, 2020 01:40 PM EDT:

You know what? I will add type-differentiated promotions to the Diagram as a standard feature. So you won't have to use any custom-supplied WeirdPromotion() routine for that. This is easy to do: I will allow suffixing any piece ID in the promoChoice string by a number. Which, when present, will be taken to mean the number of ranks (counted from the back) where it can promote. Pieces not suffixed like that will use the value given for promotionZone instead. So by writing in the Diagram definition

holdingsType=1
promoZone=3
promoChoice=!P*N*B*R2*Q1

the pieces N, B, R and Q must be in the hand (where they get by being captured) to allow promotion to them, due to the asterisk. (The P has no asterisk, because it is not really a promotion, so nothing has to be available. It is just forbidden on the last rank because of the !.) But even when the piece is available, Q would only be allowed on the last rank, and R on the last 2 ranks. B and N can be chosen on rank 1-3, P only on 2 and 3.

[Edit] I have uploaded a version of the Diagram script that implements this now. A beneficial side effect is that it now does the correct highlighting in the piece table for the pieces that can be chosen. With WeirdPromotion you could reject some choices after they were made, but it did not have any effect on the prior highlighting. It can be tested in the Gross Chess diagram.


Betza notation (extended). The powerful XBetza extension to Betza's funny notation.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Sun, Jun 14, 2020 05:50 PM EDT:

Well, the main text says:

The latter is specified by the directional modifiers on the continuation leg, and is triggered by a diagonal direction specification causing a 45-degree change in direction (as directions are always relative to the previous leg).

So there is nothing new in the use of fs here; it has always meant 'diagonally forward', i.e. at an angle of 45-degrees to 'forward'. It is just that 'forward' is a relative notion. And frankly, I don't see how that could be different. The moves of a chess piece start off in many different directions, so if you want to describe a move with a fixed shape, it is only the angle between the steps that count. An absolute orientation would be useless; it would be different for each move of the symmetry-equivalent set. Angles must always be given compared to some frame of reference; for the first step the piece is still in the origin, and the symmetry is not yet broken, so we take the player as the reference.

[Edit] As the old text apparently was not clear enough, I moved part of what was hidden in the more-about-a box to the XBetza section, and also added some more explanation there. I completely rewrote the content of the hidden box, to make more like a reference guide than an explanation.


Apothecary Chess-Modern. Large board variant obtained through tinkering with known games.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Mon, Jun 15, 2020 02:51 PM EDT:

Considerring the arguments made by Jean-Louis Cazeaux I have changed the names of 2 of the pieces to my original intent so the griffin and aanca became dragon and griffin (meaning the aanca is called griffin now).

This seems a very bad change, and it also seems you misunderstood the arguments of Jean-Louis. For one, Griffin is the established English name for an F-then-R, and it would be very confusing to now use it for another piece. Jean-Louis never claimed the Griffin would be a suitable name for the W-then-F; only that Aanca was the historic name of the F-then-R, and that it would be bad to use it on another piece. And that Aanca referred to a monstrous mythical bird for which no English name exists.

And you now use the image of a Griffin for a piece called Dragon, and the image of a bird for a piece called Griffin...


Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Mon, Jun 15, 2020 06:11 PM EDT:

I now also added shuffling to the standard diagram script. You just have to specify a parameter shuffle=... with a string of piece IDs, mentioning all the piece types you want shuffled. If you prefix one of the IDs with ! it will make sure the pieces of that type are equally distributed over the square shades. If there is a piece that has castling as one of its moves, and the pieces in the corners of the specified position are of the same type, it will make sure the castling piece ends up between the other two. (Better only use that when all shuffled pieces are on the same rank!) If you specified a symmetry in the diagram (e.g. symmetry=mirror) it will respect that symmetry; otherwise it shuffles black and white independently.

So all you have to do to turn a Diagram for FIDE into Chess960 is specify shuffle=N!BRQK .

Shuffling is triggered by pressing the 'Restart' button in the AI control bar. It then restarts from a new shuffle.

I rigged the Diagram in the Metamachy article to shuffle the Eagle, Lion, Queen and King.


Betza notation (extended). The powerful XBetza extension to Betza's funny notation.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Tue, Jun 16, 2020 01:36 AM EDT:

Apparently so; this was one of the things from the XBetza section that was also mentioned in the hidden more-about-a box in other wording, and when I amalgamated the two, and in response to your remark, I changed it to:

For instance, directions on continuation legs are always specified relative to the preceding leg, as we want the notation to specify moves of a fixed shape. Thus f should be read as "in the same direction", (e.g. mafF is a lame Alfil.) and fs as "deflected by 45 degrees left or right". This rotation of the frame of reference means that continuation legs always use the same system for specifying directions as the K atom: even for oblique and diagonal atoms f in a continuation leg only specifies a single move.


Play-test applet for chess variants. Applet you can play your own variant against.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Wed, Jun 17, 2020 06:54 PM EDT:

Problem is that just saying it is not enough; it must know whether stalemate is a draw or a loss, so that it knows whether it should go for it or avoid it, depending on whether it is winning or losing. So the stalemate result must become a parameter for the diagram, and the applet must somehow provide a way for the user to control that parameter.

I will work on it. It was first posted hardly more than 24 hours ago, and I had more problems than I expected to get promotions working properly. (We don't want to allow the AI to promote to any piece in the table, so it had to keep track of which pieces participate, and which don't.) And so far I was concentrating on the interface, how to make this reasonably user-friendly.

Feedback is much appreciated, btw. E.g. besides stalemate, should we also be able to specify other game terminations? Such as baring, or whether multiple royals would mean extinction royalty or not. Also, there are still many pieces in the list that do not have a move. Which seems a pity; as they are there anyway for their pretty looks, they might as well be used to provide the user more choice of moves without having to mess with the move definitions himself. Can you suggest any moves for pieces like Ox, Ram, Crocodile...?

I fixed the stalemate; I added a parameter stalemate=draw to the diagram, and actually made that the default. It now also prints the message. I also changed the King position evaluation in the end-game, to draw to the center (extra strong for a bare King) and to draw to the action; as a result it can even force checkmate with a Queen now, at 2 ply.

This facility isn't really meant for playing end-games; at a depth of two ply and without any dedicated strategic knowledge that will really suck. To see if pieces can checkmate a bare King we have the checkmating applet, which is based on End-Game Tables rather than search. This is intended for seeing how the design works out in the middle-game.


FrogsAndPrincess. Members-Only Based on Princess and the Frog Story.[All Comments] [Add Comment or Rating]

Since this comment is for a page that has not been published yet, you must be signed in to read it.

Home page of The Chess Variant Pages. Homepage of The Chess Variant Pages.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Sat, Jun 20, 2020 10:20 AM EDT:

I think this is a general property of this website. Whatever changes you make in files will only become visible some days later, when the caches are flushed. That doesn't apply to output of PHP scripts, which are not cached, so changes in the article text will show immediately.


H. G. Muller wrote on Sun, Jun 21, 2020 02:02 AM EDT:

Just for my understanding: This 'display_comment' is applied to anything that is displayed from the database, or just to comments in the comment section?

I guess that, strictly speaking, I should have the betza.js script add tags to the URL of the piece images it uses in the diagrams it generates, if it is to use ther most recent version of thos images always? It generates these image names itself, by concatenating graphicsDirectory, white/blackPrefix, image root name and graphicsType extension, and I could have it append another "?a=0" on that. (The standard image sets like Alfaerie of course will hardly ever be updated, but if people would use their own uploaded piece images, it could be a problem.)


Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Sun, Jun 21, 2020 01:29 PM EDT:

As far as I know, there is no easy way to skip a turn with a multi-move piece has this ability. Can this be implemented?

Do you have any suggestion for how that could be implemented? I guess that what makes it difficult is that the move-entry system makes non-destructive intermediate squares transparent, so that a back-and-forth move to an empty square only leaves a marker on the selected piece. And clicking that again deselects it. I guess I could change the priorities there, so that clicking a piece that has marked itself as target will result in a null move, rather than a deselect. It should always be possible to deselect it by clicking another piece. (And if you have no other piece, there is no reason to deselect it in the first place.) Currently it only does that if a locust victim has been specified.

But is this really important? I always though that null moves are merely a hypothetical possibility, and that in practice it would almost always be very bad to play them. The pieces that can do null moves in Shogi are so powerful that you are not very likely to get into zigzwang if you have them.


Checkmating Applet. Practice your checkmating skill with fairy pieces.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Sun, Jun 21, 2020 01:56 PM EDT:

Checkmate on larger boards

I upgraded the checkmating applet: it is now capable of generating the 3-men EGT on boards of other sizes as well. I put two controls in the text where you can select the number of files and ranks. It works up to 16x16; on my computer it could then still generate the EGT in about 10 sec. (Although this might also depend on what piece you are calculating for.)

I also put in some check boxes for selecting some board types other than rectangular: Omega-Chess type with Wizard squares, a Gustavian board, or the board used for 4-player Chess on chess.com. These are implemented by patially filling a rectangular board with unmovable, uncapturable obstacles, so you would always have to specify the outermost dimensions of the board. (E.g. Omega Chess would be 12 x 12.)

I also added checkboxes for selecting two rule modifications: you can calculate the EGT under the rule that stalemate is a win. (Used f.e. in Wildebeest Chess, to make the KWK end-game a win.) I also added a winning condition that I consider of interest myself, namely that you win when you can force the opponent into a corner. This tells you in end-games that are general draws whether the problem is some special complication in delivering the final blow (such as with Wildebeest), or that your material is just to weak to confine the bare King. Playing with stalemate=win rules is no good measure for that, as this rule makes driving into a corner easier, because you can use the threat of stalemate to do it, even when the corner is still far away.

The page for checkmating individual pre-configured pieces has also been upgraded; it also contains controls for the board size (which by default is still 8x8). These can be preconfigured through the URL, with the CGI arguments ?files=F&ranks=R.

It all seems to work; I don't really have trusted data to compare with, for most of these features.


FrogsAndPrincess. Members-Only Based on Princess and the Frog Story.[All Comments] [Add Comment or Rating]

Since this comment is for a page that has not been published yet, you must be signed in to read it.

Home page of The Chess Variant Pages. Homepage of The Chess Variant Pages.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Sun, Jun 21, 2020 03:05 PM EDT:

@Fergus:

Do you have any way in JavaScript to read the modified date of a file?

I don't know if this is still relevant for the solution you chose. But normally JavaScript would not access image files directly, but would just modify the HTML of the page so that the browser would access the images like it always does. It could directly request files from the website the page is from, but I am not sure if it can also access the 'metadata' of the file; the way would be to request the directory the file is in; that contains the date. But not all directories are accessible, also becouse the web server often reroutes requests for those to an index.hetl file in it.


Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Sun, Jun 21, 2020 03:37 PM EDT:

Null moving can currently be done by closing the AI, moving a piece back and forth, opening the AI again and press Move. For something that perhaps is needed only once every few hundred games, that doesn't seem too much trouble. Trying to do it through the normal move-entry interface is likely to have unwanted side effects for everyone. It would already be a problem that a drag & drop null move is not distinguishable from a single click to select the piece.


Home page of The Chess Variant Pages. Homepage of The Chess Variant Pages.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Mon, Jun 22, 2020 02:29 AM EDT:

I am not sure it makes sense to do this; it will probably only increase server load, because the JavaScript would fetch the results from the new.php script every time to see what is new. And this will not be cached because it contains a query string (and caching would defeat the purpose in the first place). Almost always it will do this in vain, as the piece images will almost never be updated.

If I just suffix the URLs of the piece images with a fixed query string, they would never be fetched except the first time, (which is unavoidable in any case), as the browser would have cached them. Users would normally not see updates of them, unless they refresh their own browser cache. But that is usual browser behavior; it should not surprise anyone, and it is under their own control.


Apothecary Chess-Classic. Large board variant obtained through tinkering with known games.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Tue, Jun 23, 2020 03:31 AM EDT:

Well, if I look at your page source, I see this:

<div class="idiagram">
files=10
ranks=12
holdingsType=1
promoZone=3
promoChoice=!P*N*B*L*E*R2*J2*Q3*C3*A3
graphicsDir=../graphics.dir/alfaerie/
whitePrefix=w
blackPrefix=b
graphicsType=gif
squareSize=54
symmetry=none
pawn:p:ifmnDfmWfceF:pawn:a4,b4,c4,d4,e4,f4,g4,h4,i4,j4,,a9,b9,c9,d9,e9,f9,g9,h9,i9,j9
rook::::,
queen::::,
bishop:b:B:bishop:,
knight:n:NmZ:knight:,:1
mamluk:l:WL:camel:,:1
siege elephant:e:FAH:elephant:,
joker:j:fI:fool:,
Chancellor:c:RN:chancellor:,
archbishop:a:BN:cardinal:,
</div>

You should also see that when you edit your comment in source-code mode. (Switching the submission editor to WYSIWYG mode and then back to source code destroys the diagram, don't do it!)

Most of it looks OK, but except for the Pawns, the lists of squares where the pieces should be placed are all empty. You should have something like a2,j2,,a11,j11 for the Rooks etc., but you just have a single comma. I also see no King amongst the pieces. And in the promoChoice string you probably intend to suffix Q, C, A with '1' rather than '3', if you only allow those on the final rank. (Since you have promoZone=3, '3' would be default anyway, and would not have to be specified.)

Also, you defined the piece IDs as lower case, but in the promoChoice string you then refer to them with upper case. There isn't really any reason to define the ID for pieces other than Knight, as by default it would take the (capitalized) first character of the name.


H. G. Muller wrote on Tue, Jun 23, 2020 05:16 AM EDT:

The Diagram does have a shuffle option now. But to make that work you should first place the pieces in some 'reference position', and then indicate in a shuffle option which piece types you want to permute. (It can then see the set of squares that should be involved in the shuffle.) Depending on whether the King has a castling move defined on it, the shuffle will respect its placement between the corner pieces during the shuffle, or not. In your case you have no castling, and there would be no restriction to the King placement.

In Chess960 the reference position would be FIDE; from this it would then know that the castling partners are Rooks, and that the King must remain between the Rooks. BTW, the Diagram does not implement Fischer castling; no way has been devised yet to indicate that in XBetza; the On notation would mean something else. Perhaps OX ? But as far as the shuffling is concerned, you could say shuffle=N!BRQK, where the exclamation point before the B indicates Bishops should be equally distributed over shades. When you ask it to do impossible things the results will be undefined.

I don't know whether this shuffle option satisfies your needs. A straightforward enhancement of it could be to allow multiple 'shuffle groups' (say comma separated in the shuffle option), where it would then apply the same shuffling as it does now to each group independently. (They had better be non-overlapping groups then, or the results would get statistical bias.)

And yes, your King move seems correct. But you should be able to see that in the XBetza sandbox, when you ask for the move diagram.

To see diagram source in a comment I usually click the 'View' link at the bottom of the comment to see it in isolation (so that I don't have to look for it on a page that contains lots of other stuff), and ask my browser to show the page source. There will still be a lot of stuff before it for the menu bar, and all the adds, but you can always use the browser search function to look for 'idiagram'.


H. G. Muller wrote on Tue, Jun 23, 2020 09:30 AM EDT:

1. I still have not figured out how to make the squares, brouhaha

Just define a first piece with name 'hole' (the ID, move and image fields will be ignored), and a list of 'starting squares' where you want the holes to be. Then you also specify a piece to start at one of those squares. All holes act as brouhaha squares, also during the game: you can place pieces on them, and when you then move them away they revert to black.

2. It may be a nice feature to display the brouhaha squares in a different colour

I will think about it. Perhaps dark grey.

3.I don't think the shuffling works in this particular case (please read the article) but probably a javascript code is possible to do. Unfortuneatly I don't know Java script so if you can help me here I'd really apreciate it.

Well, this sounds more like placement chess with some restrictions than like shuffling. The logcal solution would be to put all the pieces in hand (except those that have fixed location, like Kings and Rooks). For easy placement just display the piece table permanently next to the board. You can do that by defining in the diagram parameters satellite=apothecary , and then somewhere on your page put a HTML element <table id="apothecaryTable"></table> . The Diagram script will then put the piece table there, rather than collapsible under the diagram, and people can directly drag the pieces to the Diagram.


Fischer Random Chess. Play from a random setup. (8x8, Cells: 64) (Recognized!)[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Wed, Jun 24, 2020 02:38 AM EDT:

I don't recall ever doing an Interactive Diagram on Chess960. It would not be able to handle the castling. If there ever has been a Diagram of a shuffle variant, it must have been one with normal castling.


Apothecary Chess-Modern. Large board variant obtained through tinkering with known games.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Wed, Jun 24, 2020 02:40 AM EDT:

I implemented 'repeated shuffling' in the diagram now, where the shuffle parameter accepts a comma-separated list of shuffles, which are then performed in order. I also added a new shuffle limitation: a piece prefixed with ':' (colon) will not be shuffled to different shades (like a '!' prefix would do), but to symmetric locations. (Which, on boards with an even number of files, should also have opposit shades.) Better make sure to apply it only to an even number of pieces on a set of symmetrically distributed locations!

I think this should allow you to do the shuffling you want, through a trick: When you shuffle (say) Knights and Bishops with :BN specification, it can only leave them as they were, or swap the N and B on both wings. Otherwise the Bishops would no longer be symmetrically positioned.

So what you can do is start the Bishops in the d- and g-file, and (say) A and C on the b- and i-file, and then shuffle A:BC. This will make the B end up either on d/g or b/i, with 50-50 chance. After that you shuffle B and N (which started on c- and h-file), as :BN, to randomize those while preserving symmetry. Finally you shuffle ACQ without limitations. So the specification would be shuffle=A:BC,:BN,ACQ .


H. G. Muller wrote on Wed, Jun 24, 2020 04:15 AM EDT:

OK, I see that my trick did not work for swapping b and d, as these are same shade, so that the B must get automatically to opposit halves, and the : adds nothing extra. I changed the meaning of : now to explicitly mean "mirror-image location", and adapted the Diagram script for that. This should make your diagram work as you have it, with the updated script.


H. G. Muller wrote on Wed, Jun 24, 2020 04:33 AM EDT:

I think caching again is broken on this website. I uploaded a new Diagram script, but when I read it back from the website, it shows the old text. Only when I suffix the URL with some random suffix, like ?t=1234, I get to see the newly uploaded text.

So this is what you can do as a work-around too: suffix the URL to betza.js in your comment to make it betza.js?nocache=true , to make sure it will use the new script. You still would have to flush your browser cache. When I tried the current script locally on your diagram, the shuffling works as it should.

BTW, note that when you specify symmetry=mirror (as you must, to preserve vertical symmetry during shuffling), there is no need to mention the location of the black pieces, as the Diagram would automatically add those. So you could leave out the double comma and everything behind it, even for the holes.


Home page of The Chess Variant Pages. Homepage of The Chess Variant Pages.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Wed, Jun 24, 2020 07:06 AM EDT:

I still wonder why so many of the pages I authored carry a "missing description" in the index. I am not aware of having done anything different from usual when I submitted those. And I did not see a place where this description could be edited; when I click 'Edit index information' in the page-edit form, I get to see the same form that you have to complete first on a new submission, and the description seems to be not amongst the items there, even on submissions where it is not missing. (And I also would like to edit those, as one of those contains a typo.)


H. G. Muller wrote on Wed, Jun 24, 2020 02:23 PM EDT:

Well, I would like to request then that what I have written in the "What's new" field to be made into a short description for all the pages I authored that now say "Missing description".


Betza notation (extended). The powerful XBetza extension to Betza's funny notation.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Thu, Jun 25, 2020 04:16 AM EDT:

The X suffix for 'extended' atoms was somewhat of a hack, to quickly solve a problem that occurred. I am not very happy with it, expecially since the amount of extension is dependent on the lateral step of the atom. I don't like the coordinate notation (1,4) much either. For one, I would like to reserve the parentheses for grouping modifiers, or just for the purpose of enhancing readability. Brackets like [1,4] would look better, IMO.

The dilemma here (as always) is whether we want to go for something universal, which requires an infra-structural investment (in this case the brackets and the comma) to make it work even in simple cases, or use an ad-hoc solution that captures a few cases in a very simple way (such as the X suffix), but offers no universal relief. BTW, the suffix solution could be made universal by allowing repeated suffixes, like in Roman numerals vs arabic digits. Depending on the frequency distribution of the numbers encountered in practice, one system or the other would on average give the most compact representation. (Or, to say it differently, run-length encoding only gives compression on texts that frequently contain long repetitions of the same character.)

The X system is lame, however, and I now regret having implemented it. Perhaps it is not too late to change it. A better solution of this type would be to have two suffixes: X for adding an H step, and Y for adding an A step to any given atom, and allow repetition of as many X and Y as is needed. Primitive, but more consistent than the current X suffix. And HXX for [0,9] is still only 3 characters vs 5, HXXX for [0,12] is 4 vs 6, only after HXXXXX for [0,24] the coordinate system starts to need fewer characters. And would we ever want to describe pieces that leap more than 24?

The atom table would then become (1 quadrant shown):

HX CX ZX GX DYY
DX NX AX CY ZY FYY
WX FX DY NY AY
H  C  Z  G
D  N  A  Z
W  F  N  C
#  W  D  H 

💡📝H. G. Muller wrote on Sat, Jun 27, 2020 03:52 AM EDT:

The Diagram's AI implements rules of not passing through or out of check as a generalized en-passant capture, where in the case of a royal any piece would be allowed to make the capture through its normal capture moves. So whether moving through check is allowed can be indicated in the move of the royal by having it create e.p. rights. For castling this is implied already by the O atom, also that the starting square itself becomes an e.p. square, so that castling out of check is also illegal.

XBetza uses the n on a stepper atom (W, F, where non-jumping has no meaning) to indicate it creates rights. On sliders that repeat such steps I now create them only at the end-point of each step. So that nQ on a royal means you cannot move through check, but you can move out of check. Which is in general what you want. That you also create rights where the piece ends up doesn't matter, as the piece could be captured there anyway. If it would automatically also create rights on the starting square of a slider leg, it would be rather cumbersome to describe the case where you want to allow moving out of check; you would have to make it a 2-leg move, first making a single step without creating rights, and then continue as a slider (through a range toggle), a sort of 'rectified' Griffon, yafnK. So I opted for creation of rights at the target square of a step, also for single steps.

But for Apothecary Chess you want to have this on larger leaps, where the n cannot be used for this purpose, and you want it on the initial square. The solution is very cumbersome: you would have to break up the N and C moves into King steps seamlessly glued through mp modes, and furthermore make an extra back-and-forth step to the starting square to make the step that arrives there create the e.p. rights, as a step that leaves it can not.

Perhaps I should just adopt the convention that initial moves on royal pieces automatically create the rights at the starting square, so that they can never be made out of check. This is usually the rule. The problem is that you can then never indicate that you do want to allow it out of check. Another possibility would be to double the i modifier for this purpose, as an indication you have to be 'extra virgin' to make the move, i.e. not even checked.

[Edit] For now I have disabled all i moves on a royal piece that is in check, in the AI. (It doesn't make a distiction based on the number of i.) I also changed the handling of e.p. capture by the AI somewhat: at any square along its path the piece checks whether it hits a square for which e.p. rights exist. If they do, and the move can capture e.p. has e mode, or c mode when the last moved piece was a royal, it allows the e.p. capture irrespective of the square occupant. For e.p. on non-royals you better make sure they never generate rights on a square occupied by an enemy. For royals, the captures are never really made, but as soon as it is detected they are possible the line terminates with a winning score, as it would mean the royal gets captured. This allows for instance forbidding hopping over enemy pieces that are protected, as is needed in Metamachy.


Sac Chess. Game with 60 pieces. (10x10, Cells: 100) [All Comments] [Add Comment or Rating]
H. G. Muller wrote on Sat, Jun 27, 2020 12:57 PM EDT:

And why the strange piece IDs, that seem to be totally unrelated to the piece name? 'T' for Amazon, 'G' for Sailor??? And what the heck is a 'disjunctive compound'? Is there more than one type of compound?


H. G. Muller wrote on Sun, Jun 28, 2020 08:50 AM EDT:

Sissa is a compound of rook and bishop but its move is not disjunctive, it is conjunctive.

Conjunctive = A and B

Disjunctive = A or B

Am I right?

I have never seen the word 'compound' used in sequential meaning; I would say the Sissa is an (isosceles) hook mover. And I would not say the Tai Shogi Hook Mover is a (conjunctive) compound of two Rooks. The word 'or' usually implies 'and', and if you consider this operations on the move sets, the 'conjunctive compound' of R and B would have no moves (as B and R have no moves in common), and the conjunctive compound of K and R would be the Wazir, etc. There doesn't seem a case where this cumbersome way of describing more elementary move sets is useful, as they tend to all have simple names of their own. Note that the Sissa can neither move as a Rook, nor as a Bishop.

It seems to me the addition of 'disjunctive' serves no other purpose here then sow confusion in a case that otherwise would be correctly understood with 100% certainty.


H. G. Muller wrote on Sun, Jun 28, 2020 05:15 PM EDT:

Some sections are very poorly formatted; even the images are just part the lines. And division into paragraphs is sorely missing in a very long text.


H. G. Muller wrote on Sun, Jun 28, 2020 05:53 PM EDT:

Yeah, I know. I have to be very careful never to switch off 'Source code', once I have started to do advanced things. Or they would all simply disappear. Embedded JavaScript disappears completely, Diagram definitions become line-filling text, the 'id' names of HTML elements are all forgotten...


Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Mon, Jun 29, 2020 06:37 AM EDT:

That is correct. It does count all ranks, also the brouhaha squares. It doesn't make an exception when there are only dark squares on a rank, and brouhaha squares are still part of the board. I thought it was allowed to capture to brouhaha squares, and there is no reason why such a capture could not also be a promotion.

So you would have to define promoZone=4, and adapt the rank limits in the promoChoice string accordingly.


Play-test applet for chess variants. Applet you can play your own variant against.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Mon, Jun 29, 2020 05:04 PM EDT:

I now put a somewhat more refined search in the AI of the Interactive Diagram, in the hope that this would make it more human-like w.r.t. the things it will overlook. It now focuses its attention more on moves that are logical continuations of what happened before. In particular moves that 'touch' squares that were mutated one or two ply earlier. That would include recaptures, plunder raids, discovered threats, pin punishment. But also hopper activation; it doesn't matter whether the mutation was evacuation or placement; if a move goes over or to it, it gives it more attention than other moves.

As this search is much less fixed-depth than the previous one, the meaning of the ply setting has become a bit vague. If we count PV moves as one ply, most non-captures elsewhere in the tree would count double. I made the '2 ply' setting such that it will still search every reply to the move it intends to play (validated by an exchange evaluation), which means that the PV will actually be 3 ply long. Recaptures are now only not counted in the depth when a lower-valued piece captures a higher or an unprotected one; recapturing a lower protected piece doesn't get more attention than any other capture (or PV move).

It is still true that at 2 ply it wouldn't see a (new) mate-in-1 threat against it, and at 3 ply it will. It would see it when it can checkmate you in one at 2 ply.

As this is a bit more bug-prone than the very simple original search, please let me know if it shows erratic behavior. I am aware that its play with Pawns currently sucks. I could easily put in some evaluation that would solve this for FIDE/Shatranj Pawns, but that would break the generic nature of the AI. It does seem to be the kind of Pawn for which this is most important, though; there don't seem to be many subtleties with Asian or Berolina Pawns. (And of course the overwhelming majority of CVs have FIDE Pawns.)

I am open for suggestions for what additional features (other than pieces with nearly arbitrary moves) could be supported by the AI to make it more useful.


Musketeer Chess. Adding 2 newly designed extra pieces. (8x8, Cells: 64) [All Comments] [Add Comment or Rating]
H. G. Muller wrote on Tue, Jun 30, 2020 05:18 PM EDT:

Well, the author of that page is one of our new editors...


Brouhaha. Like Chess, but it really brings the ruckus! (8x8, Cells: 72) [All Comments] [Add Comment or Rating]
H. G. Muller wrote on Thu, Jul 2, 2020 03:04 AM EDT:

What do you think? Would it work?

Usually, the fewer rules the better, and the simpler the rules the better. Pretty much anything can be made to work, when you take away all the reasons why they would not work by additional rules. Most choices in CVs are arbitrary. Which is why there are so many. As I see it the 'brouhaha squares' are just one such arbitrary choice that work through very simple rules. To implement them in the Diagram's AI was also trivial.

I think that (in Brouhaha, at least) capture on a brouhaha square is mostly hypothetical; in practice players would develop their pieces long before these squares could come under attack, being sheltered by two fully occupied ranks. This would be different when you added brouhaha squares at the side edges near the middle; then this would become a real issue. But the simplest remedy to that is not do it. Why would you? Plenty of room near the back rank.


H. G. Muller wrote on Thu, Jul 2, 2020 09:27 AM EDT:

I guess it depends on how one formulates the rules. I saw the special rule that defines these squares as "turns into inaccessible when abandoned, rather than empty". And I also implemented it that way, by replacing board[fromSquare] = 0; in the MakeMove() routine by board[fromSquare] = background[fromSquare], where the background array then could be initialized with empty and inaccessible squares as desired. (Inaccessible squares were already implemented, for the purpose of simulating non-rectangular boards.)

So the rule that you can capture the piece on the brouhaha square was not really an extra rule, as it is normal that you can always capture any piece. It would have required quite some extra code in various places to forbid pieces to enter it (or hop over it) even when a piece was occupying it; every move would have to test the background under the piece as well as the board itself. And it would become even more complex when you had to make exceptions for what the piece on the brouhaha square is forbidden to do compared to its normal capabilities. Especially if this included blocking check.


H. G. Muller wrote on Thu, Jul 2, 2020 03:38 PM EDT:

But you could also have said: "that square disappears when it gets empty".

From the description of Cheshire Cat Chess:

Every time a square is vacated, because a piece moves away from it, the square disappears.

They don't bother to mention that you can capture pieces while they are still on the square. They do mention pieces can move over such disappeared squares, though. (Which is indeed worth mentioning, as I would not expect that. And I don't think that would apply to brouhaha squares, e.g. by a bent slider.)


H. G. Muller wrote on Thu, Jul 2, 2020 04:59 PM EDT:

Right, although one could argue that in Brouhaha not all the squares between the Scouts and the Clerics are 'brouhaha squares'. But in Aurelian's game, which has 5 adjacent brouhaha squares, A rook should not be allowed to capture from one to the other once the intermediate pieces have left their launch square.

The Interactive Diagram I also does not allow sliders to move over the blacked-out squares; they are considered 'off board'. This because their original purpose was for implementing irregularly shaped boards, like Omega Chess. Leapers can jump over them, though. Actually I am not sure what hoppers would do, or even what they should do. One interpretation of inaccessible squares is that they are occupied by uncapturable unmovable pieces, and in that case hoppers might want to use them as mounts!

I guess it would be easy to distinguish several different types of 'terrain' for use as 'background' to which an evacuated square reverts. It would all be inaccessible, but one flavor could be blocking to anything, while another flavor could allow sliders to fly over it, and another could allow hoppers to use it as mount, and these could even be combined as independent properties.


Shogi. The Japanese form of Chess, in which players get to keep and replay captured pieces. (9x9, Cells: 81) (Recognized!)[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Sat, Jul 4, 2020 06:15 AM EDT:

I still have some doubts with regard to the application of this rule. In particular, when a (checking) position occurs from which it is possible to deliver perpetual checking, but instead of continuing the checking you play something else. And then later, that position occurs a second time. Now you do continue the checking, and the opponent has no way to escape it, so you get a 3rd and 4th repetition of the position.

Does this now count as perpetual checking? Not all moves since the first occurrence of the position were checks. But all moves since the 2nd and 3rd occurrence are. In my engines I would only consider the moves since the previous occurrence. (Especially because it already terminates the line at the 2nd occurrence; if it cannot break from the loop the first time it goes through it, nothing will change by trying it the second time, except that you have less search depth left, which will degrade the accuracy of the evaluation.)

I would think that only considering the moves since the previous occurrence would be more in line with the spirit of the rule; you try to force a repetition by perpetual checking, and this should not be allowed. It is just that you started the checking a bit late, but now that you are at it, and can keep it up perpetually, why should that matter? When I asked it to a Japanese in connection with mini-Shogi, however, he told me this would not be considered perpetual checking, and thus produce a sente loss. (Which is a special mini-Shogi rule; in regular Shogi that would be a draw.)


Betza notation (extended). The powerful XBetza extension to Betza's funny notation.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Sat, Jul 4, 2020 04:36 PM EDT:

Well, xK borrows moves from neighbors, and the move diagram shows pieces on empty boards. So there isn't really anything to show. On the board it would just behave as the compound of all its neighbors, without specially indicating which those neighbors are.

It does seem mildly useful to highlight the squares where it could borrow from, like it does now. I am not sure why it does that in red, which is the color for capture-only. I guess I should define an entirely new color for it.


💡📝H. G. Muller wrote on Sun, Jul 5, 2020 04:30 AM EDT:

Argh! You are right. It used to do that, but I broke it when implementing the Imitator. Both the Imitator and the move borrowing call the old move generator used for highlighting recursively. But for the imitator I added an extra argument, to restrict the moves of the target piece to the mode that you imitate (e.g. if you have a cI it should only imitate the captures). I had forgotten to pass this argument in the call for borrowing moves, and the missing argument then was interpreted as 0, so that you would never borrow anything.

Thanks for spotting this; I now fixed it.

The selective imitation does not really work satisfactorily anyway on multi-leg moves. Because it is not clear what are captures and what not. E.g. a Checker would have a capture in its first leg, and then a non-capture where it lands, and the selective imitation would now always reject one of the legs. While intuitively we think of the move as a capture (I think). So perhaps multi-leg moves should be considered captures when any of their legs makes a capture, no matter what the other legs do, for the purpose of selective imitation.

Not sure if there exist any CVs with selective imitation anyway, so this didn't have a very high priority...


💡📝H. G. Muller wrote on Sun, Jul 5, 2020 03:23 PM EDT:

Right, I did not account for multiple move borrowers. I do exclude borrowing from the same piece type, as Odin's Rune Chess has a pair of move-borrowing Kings that start next to each other. So I learned about the problem you experienced the hard way too.

Passing a flag that suppresses recursive borrowing, as you suggest, would indeed be a more robust solution. A more complex solution would be to make a list of piece types from which you already borrowed. Or even better, moves that you already borrowed, and don't borrow moves you already have borrowed from another piece (or had to begin with). That would avoid duplication of moves when you have more than one piece of the same type next to you, or pieces with overlapping moves suchas Q and R. Which would greatly increase the efficiency of the AI as long as it has no transposition table.

I think I will go for the simple flag, though, and hope one day I will get to equip the AI with a TT. In fact the infra-structure is already in place: the routine now passes a mask that suppresses some of the modes by clearing their flags, for the purpose of imitation. There I use it for clearing m or c flags. But the x flag is also in there.

[Edit] It should be fixed now. (Untested!)


Venator ChessA game information page
. Introducing the Venator, a bifurcation cannon related to the Korean cannon, on a Gustavian board (zrf available).[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Mon, Jul 6, 2020 02:21 PM EDT:
files=10 ranks=8 promoZone=1 promoChoice=QNBRV graphicsDir=/graphics.dir/alfaeriePNG/ squareSize=50 graphicsType=png hole::::a2-a7,j2-j7 pawn:P:ifmnDfmWfceF:pawn:b2-i2,,b7-i7 knight:N:N:knight:c1,h1,,c8,h8 bishop:B:B:bishop:d1,g1,,d8,g8 rook:R:R:rook:b1,i1,,b8,i8 queen:Q:Q:queen:e1,,e8 venator:V:gafyafsR:champion:a1,j1,,a8,j8 king:K:KisjO2:king:f1,,f8

This article has no graphics and a very minimal description, so let me post this diagram to liven it up a bit. Also a good opportunity to draw some attention to the class of pieces known as Bifurcators. The Venator is not nearly appreciated as much by the Diagram as it is by its inventor: only about 2/3 of a Knight. This is not to say the Diagram is right, of course. For one, it only tries to estimate intrinsic tactical ability. A piece like the Venator has great forking power in dense positions, so it will be almost impossible to prevent the players can trade it for another minor in an early stage.


Home page of The Chess Variant Pages. Homepage of The Chess Variant Pages.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Tue, Jul 7, 2020 02:21 AM EDT:

What happens when, in the diagram, you specify graphicsType=png?nocache=true ? I am not sure this would help, though, as the other images in your article also don't seem to have a ?nochache=true suffix (as seen from the page source). I understood from what Fergus said that all URLs in the src field of a HTML tag when retrieved from the database would automatically get this suffix. But I apparently misunderstood that, because the betza.js in the <script> tag in an article or comment also don't get that, so that they do not use the updated version unless I add it by hand. I have now adapted the Interactive Diagram Design Wizard to always add that suffix, so it would bypass the server caching. But it could be needed for the image names generated by the script as well.


H. G. Muller wrote on Tue, Jul 7, 2020 03:51 PM EDT:

Sure, but I what the PHP script sends you should show up at the client side when you look at the page source. I was puzzled by that Adam reports a different behavior between the images in the piece section, which are in the retrieved HTML part, and those in the Interactive Diagram, which are client-side JavaScript generated. Because neither of those has a nocache=true suffix. The image tags in the original page source look exactly like those that the JavaScript would generate.


H. G. Muller wrote on Wed, Jul 8, 2020 04:01 AM EDT:

The strange thing is that the images Adam uses in the piece section are the same images as that are used in the Diagram. So if after a few days the images in the piece section get flushed at Cloudfare, I would have expected the same to be true for those in the Diagram. I understand that when you would add ?nocache=true (or apparently any dummy CGI arguments), you would bypass Cloudfare, and always get the up-to-date CVP info. But none of Adam's links had that when I looked, neither in the piece section, nor in the Diagram.

As the Diagram constructs the name of the image files by concatenating graphicsDir + colorPrefix + rootName + '.' + graphicsType, the user can force bypassing of Cloudfare by suffixing the graphicsType with ?nocache=true . The images would still be cached in his own browser (as repeated access always uses the same CGI arguments), like any images in the page, but he can flush those himself.

I thought of having the Diagram add the ?nocache=true suffix automatically, but I decided against it. For one, it would be a rare situation that piece images get updated. Normally, when creating a Diagram, one would use existing piece sets on the site, or freshly uploaded membergraphics. Even if an update would take place, it would become effective for everyone in just a few days. And if the usuer is in a hurry, he can add the suffix to the graphicsType himself.

For other images in the original HTML the user must also add the ?nochace=true suffix by hand, if he wants to see updates instantly. E.g. when I publish new Diagrams here, which I usually do for the purpose of testing new features of the betza.js script, I add the ?nocache=true to the link to that script, to make sure I use the just updated version. That older Diagrams elsewhere still keep using older versions of the script doesn't matter, as they did not need the new features, so the older version should be perfectly OK for them. There would be no attempt to load the updated script anyway unless the user explicitly ordered his browser to flush the cash; like image files, separate JavaScript files are also cached by the browser.

Another reason is that I sometimes abuse the Diagram's graphicsDir parameter for specifying a complete URL including CGI arguments, so that the colorPrefix + rootName will be appended as (value of) CGI arguments, for driving a server-side script to generate the piece graphics. An extra ?nocache=true would then violate URL syntax.


The new editcomment.php script[Subject Thread] [Add Response]
H. G. Muller wrote on Fri, Jul 10, 2020 07:24 AM EDT:

I think the CKEditor was a lot more user-friendly then markdown. It made it very easy to enter simple text messages with common typographic refinements. You just had to be careful to never switch off 'source-code' mode once you had messed with the HTML.

The new script doesn't seem to have an exit: when you click 'post' after having seen the preview, it goes back to edit mode.


H. G. Muller wrote on Fri, Jul 10, 2020 11:04 AM EDT:

On my desktop monitor: 1680 pixels.


Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Sun, Jul 12, 2020 02:12 AM EDT:

Oops, I inadvertantly unbalanced parentheses when fixing the problem that in the checkmating applets it insisted the first piece should promote when the piece table was open (despite promoZone=0). Fixed now.


Home page of The Chess Variant Pages. Homepage of The Chess Variant Pages.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Sun, Jul 12, 2020 02:15 AM EDT:

I share that opinion.

I also don't see a link in the footer to return to the general comments listing. Only to the comments for the particulat page.


Shatranj Kamil (64). Modern Shatranj based variant on 8 by 8 board with new pieces. (8x8, Cells: 64) [All Comments] [Add Comment or Rating]
H. G. Muller wrote on Sun, Jul 12, 2020 03:34 AM EDT:
files=8 ranks=8 promoZone=1 promoChoice=S graphicsDir=/graphics.dir/alfaeriePNG/ squareSize=50 graphicsType=png stalemate=win baring=0 pawn:P:fmWfcF:pawn:a2,b2,g2,h2,c3,d3,e3,f3,,c6,d6,e6,f6,a7,b7,g7,h7 knight:N:N:knight:b1,g1,,b8,g8 rook:R:R:rook:a1,h1,,a8,h8 general:G:F:ferz:d2,,d7 elephant:E:AmD:elephant:d1,e2,,e7,d8 silver:S:FfW:silvergeneral:c1,f1,,c8,f8 king:K:K:king:e1,,e8

Interactive diagrams. Diagrams that interactively show piece moves.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Sun, Jul 12, 2020 02:12 AM EDT:

Well, Chu Shogi seems to be the only case where this exception exists, and it makes no sense to tailor a diagram that is intended for general use too much to one specific variant. The diagram already has a 'hook' for customizng promotion rules to a variant: the page can provide a function WeirdPromotion() for sanctioning a default promotion, or altering it. I guess it would have been better if the Chu Shogi exception for last-rank Pawn promotion would have been implemented through that. Now the Diagram does it by default, it also happens in Dai Shogi, where the rule makes no sense (and thus probably would not have applied) because it is always better to promote a Pawn to Gold when entering the zone.


MSmelee-chess[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Mon, Jul 13, 2020 09:31 AM EDT:

It says that when it has no royal piece. It doesn't automatically assume that a piece called 'King' or is depicted by the conventional king symbol is royal. Perhaps this is a mistake, and I should make it do that by default. But as it is now, it assumes the last piece of the table is the royal piece. In your case that it a promoted type, not present initially, hence the complaint. (It doesn't actually test whether the opponent does have a royal iafter it discovers it has none, as this situation usually occurs only when his own royal was just captured.)

When the royal piece is not the last piece in the table (or you have multiple royal piece types), you must explicitly specify the royal type by adding a royal=N parameter. In your case, you would have to specify both royal=8 and royal=16 amongst the Diagram parameters, as you want both King and Lion to be royal.


The new editcomment.php script[Subject Thread] [Add Response]
H. G. Muller wrote on Mon, Jul 13, 2020 09:33 AM EDT:

The 'Edit' links seem to have disappeared from all my comments. Is there another way to modify a comment now?

[Edit] Forget about this; I see the link now. Not sure what was wrong before, it said I was logged on.


MSmelee-chess[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Mon, Jul 13, 2020 01:47 PM EDT:

You can click on the 'move' header of the piece table to switch that column between displaying the Betza notation for the move, and the piece value. But you should not take the values too seriously. For one, they are estimates for the value the piece would have in a game without piece drops. When pieces can be dropped this tends to push the values closer together, as even the pieces with very low mobility can easily be transported to remote locations where they deliver threats immediately by dropping them. Also, with piece drops the promoted value has more impact, because pieces tend to be dropped in the zone, and then promote very easily.

Even in games without drops some of the well-known piece values are wrong. (E.g. the Archbishop.) Amazingly enough the ratio of the values of the orthodox pieces seems very reasonable. But the algorithm is based on (smartly weighted) average mobility only, and it does not recognize handicaps such as color binding, or worse forms of area binding. So it would likely over-estimate the value of, say, an Alibaba. That the value of a FIDE Pawn it gets is reasonable is probably just a coincidence, because it ignores the latent value due to the promotability, but also does not realize the Pawn is bound to a single file. These errors seem to largely cancel each other.

The Diagram's AI is not intended to be an analysis tool for piece-value determination; its purpose is to act as a not-too-stupid sparring partner for somewhat experienced chess players who just learned the rules of a new variant. Very accurat piece values are not needed for that purpose. That it can show the values at all was mainly for debugging purposes.


The new editcomment.php script[Subject Thread] [Add Response]
H. G. Muller wrote on Tue, Jul 14, 2020 02:47 PM EDT:

Authors might still be interested in discussions between other people in the comment section. Wouldn't it be better to send a notification to both the page author and the poster of the comment that is replied to?


Play-test applet for chess variants. Applet you can play your own variant against.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Thu, Jul 16, 2020 07:35 AM EDT:

Just to probe the amount of negativism this idea still provokes: wouldn't it be cool if, next to a button 'Show HTML', which displays the code for an Interactive Diagram of the set-up variant that can be copy-pasted into any HTML page, there also was a button 'Show GAME code', which would display code that could be copy-pasted to make a Game Courier rule-enforcing preset?


Chu Shogi. Historic Japanese favorite, featuring a multi-capturing Lion. (12x12, Cells: 144) (Recognized!)[All Comments] [Add Comment or Rating]
📝H. G. Muller wrote on Thu, Jul 16, 2020 10:14 AM EDT:

They are in graphicsDir=/membergraphics/MSdaishogi/ .

Just go to the web page http://chessvariants.com/membergraphics/MSdaishogi to see how they are named.


Play-test applet for chess variants. Applet you can play your own variant against.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Thu, Jul 16, 2020 10:53 AM EDT:

OK, let me stress that I hardly know anything about GAME code. But I read somewhere that it is a Turing-complete programming language. I don't doubt that Betza notation is very far from GAME code, but it is also very far from JavaScript. And it wasn't all that hard to write a move generator driven by Betza notation in JavaScript. The Diagram script first compiles the Betza string into lists of 'move legs', where each leg can be either a leap or a slide in an absolutely specified direction, and specifies what must be at the square it ends on (friend / foe / empty). These lists are then interpreted at 'run time', i.e. when the Diagram needs to highlight squares, or the AI needs to generate a list of pseudo-legal moves for a given position. So my first thought would be to translate that move list to GAME code, plus a universal GAME-code routine that interprets the list in the context of a given position, just as the JavaScript routine does for the Diagram.

For the purpose of making a server the only tasks would be to determine whether an input move is pseudo-legal in a given position, and whether the royal is capturable in a given position. Both could be done by having it return TRUE as soon as it stumbles on a move that fits the description (i.e. matches a given destination, and in the case of an input move, also a given origin (and perhaps promotion choice or additional info, such as locust squares), which is (partly) guaranteed by only generating the moves for the piece at the origin, if an origin is given.


Diagram Editor with scalable graphics. An easy-to-use tool for drawing boards and pieces of any size and color.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Thu, Jul 16, 2020 12:07 PM EDT:

I think changes in the script (probably the background for brouhaha squares) broke the resizing as it was done on this page, as not all board-sized arrays were extended in size. I hope I fixed this now.


MSlusus-chess[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Fri, Jul 17, 2020 04:36 AM EDT:

A FIDE Pawn would be ifmnDfmWfceF . The ifmnD is the initial (i) non-jumping (n) double push. The e in fceF indicates it can e.p. capture. (An inD move automatically generates e.p. rights on the square it passes through.) The Play-Test Applet offers several different Pawn types with predefined move; if you use that to create the Diagram, be sure to pick the correct one.

As to your Middle Xiangqi Diagram: there is no standard feature to confine pieces to the Palace, but it would pay attention to a user-suppled JavaScript function called 'BadZone' on the same page that tells it where pieces of a certain type are not allowed to go. It is also possible to provide a function 'Shade' to force a different checkering pattern. In the Diagram I made for regular Xiangqi I accompanied it with

      <script>
        function BadZone(x, y, piece, color) { // enforce board zones
          if(touched) return 0; // not during ShowMoves()
          if(piece == 4) return (color ? y < 5 : y > 4); // Elephant: across river
          if(piece != 3 && piece != 8) return 0; // otherwise OK if not Advisor or King
          return x < 3 || x > 5 || (color ? y < 7 : y > 2) && (board[y][x] & 511) != 8;
        }
        function Shade(x, y) {
          var col = 0;
          if(y > 4) col = !col;
          if(x > 2 && x < 6 && (y < 3 || y > 6)) col= !col;
          return col;
        }
      </script>

In this diagram piece 4 was the Elephant (but it seems your Elephant can cross the River, so you would not need that line) and 3 and 8 were Advisor and King. The Shade function colors both board halves differently (y > 4, for ranks 5-9), and gives the Palace the opposit shade of the half it is on.

Unfortunately there is no way to use those functions if there is more than one Diagram on the same page: all Diagrams would then use them, as there is no way to indicate to which diagram they belong. Perhaps I should design a solution for that.

[Edit] I now made it possible to force diagrams to ignore the presence of a function BadZone or Shade on the page, by including the parameters zonal=0 or shady=0 . That means still at most one Diagram on a page can use such functions. But they are supposed to be only rarely needed, and one doesn't need multiple Diagrams on the same page often anyway.


Play-test applet for chess variants. Applet you can play your own variant against.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Fri, Jul 17, 2020 07:36 AM EDT:

What would be the best place to read up on GAME code? There seems to be a lot of material about it here, but it seems that GAME code evolved a lot, and not everything is up to date.

One thing that is not clear to me after glancing through one of the tutorials is how these code snippets are embedded in the larger design of the server. I would have expected checking a given move for pseudo-legality to be a different task from performing a move for updating the position, but I did not recognize that in the examples. E.g. the routine for Pawn moves seems to automatically clear the e.p. square. Which seems a problem if the move later turns out to be illegal (e.g. because the victim on the e.p. square was sheltering your King). Is there an automatic takeback when you say 'die' at any stage?

I am not worrying so much about elementary leapers, sliders and their compounds. (Although a very large fraction of CVs don't use anything more than that.) The real challenges are more complex moves, such as bent sliders, hook movers, locust captureres. Espcially if they are not uniquely specified by just two squares.


💡📝H. G. Muller wrote on Sat, Jul 18, 2020 12:54 AM EDT:

I did read the tutorial How to Enforce Rules in Game Courier (2016), but some things where not entirely clear to me:

  • When it discusses the code for promotion in the Post-Move code, it mentions how to reject a move R a1-f1; Q-a1;. I don't understand the Q-a1. Must pieces be promoted on their starting square? Why not on f1? Are the moves also evaluated right to left?
  • Apparently the input format is such that promotion is written as a separate, extra move. How is such a sequence of moves handled by the basic input system before the Post-Move code is invoked? Their seems to be no provision for multiple moves, just origin, dest, moved and old. Yet you can test the board (spaces) to check whether promotion took place. Are all moves of the sequence performed, and do the variables only convey the parameters of the last move that was processed? Do promotion 'moves' alter any of these variables?
  • What happens when you promote an empty square? Is that equivalent to dropping a piece on that square? (That would be useful e.g. for pieces that swap location with other pieces.)
  • Can you 'promote' something to an empty square?
  • In several places it is mentioned that the Post-Game code is executed only after all moves have been performed. What does this 'all moves' refer to? Normally (ie. for non-promotion) there would only be a single move to perform, right? Namely the one the user entered.
  • What is the convention for entering non-implied locust captures, like for the Chu-Shogi Lion? Is it capture followed by a move to the destination, or a direct move to the destination followed by promoting the locust victim(s) to empty squares?
  • Should automatic locust captures, such as for the Ultima Long Leaper, be explicitly specified, or should they be automatic side effects of the move to the destination?

💡📝H. G. Muller wrote on Sat, Jul 18, 2020 12:54 AM EDT in reply to Fergus Duniho from 12:54 AM:

No, you can add a new piece to an empty square, but that would not be called promotion.

I meant: would it be possible to clear a piece from an occupied square by 'free-dropping' an empty square on top of it (e.g. by entering @-f1). And come to think of it: the code that checked the promotion just looks whether the piece at 'dest' after the move is still 'moved'. But what if someone would have really entered the typo R a1-f1; Q-a1; ? Presumably that would leave a Rook at f1, so you would not catch that. Would it have free-dropped a Queen at a1 after the Rook moved ('fertile Rook')? Or is there some intrinsic test on the input that enforces that promotion moves can only free-drop on dest? (Probably not, because that would make the mention of any square redundant.) Because the promotion move doesn't set any variable similar to dest, it isn't clear to me how you could test whether free-drops go to an allowed square.

BTW, some variants allow only promotion of a piece that was lost before, and in those it can make sense to collect the captured pieces in a separate area (without color flip), and move them from there to effect promotion.

I have never programmed Chu Shogi, and I'm not sure what a locust move is.

'Locust capture' in general is capturing a piece on a square you are not moving to. Like capture in Checkers, or e.p. capture in orthodox Chess. But in these two cases the capture is an implicit side effect of the move. So the Pawn subroutine can recognize e.p. capture, and automatically remove the victim, without the user having to enter any additional moves. (I guess promotion in Shatranj or Makruk could also be handled that way.) The problem arises when the capture would be optional. E.g. in Odin's Rune Chess a Forest Ox moves and captures like a Knight, but can in addition remove one other enemy piece adjacent to its destination. So there you would somehow have to indicate whether you want to do that, and if so, which of the (possibly eight) adjacent pieces. F c3-e4; @-d5; could be a suitable notation for that, if such a thing were allowed.


💡📝H. G. Muller wrote on Sun, Jul 19, 2020 04:21 AM EDT:

OK, so I could allow moves and captures for the first move, and promotions, suicides and freedrops for the second (and perhaps third) move, depending on whether the game needs those. (Freedrops would only be needed when there participates a piece that uses an 'unload' modifier in its Betza notation, and suicides only when there are multi-leg moves that can capture on a non-final leg.)

The question is how the presence of suicides or freedrops in the input move is relayed to the post-move code so that it can check for their legality. For promotions it could just check 'space dest', because the basic input system already enforced that these could only alter the piece that just moved. But the freedrops and suicides could strike anywhere. Is there a variable similar to 'dest' that tells which location they altered, or must I make a copy of the board before the move to compare to afterwards, to see if anything was changed, and what?

Is the post-move code run after each move in the sequence, and then the post-game code at the end? But then I don't understand how the code in the tutorial can work, because promotion happens only in the second move, so that the first move should be flagged as illegal when you run the post-move code after it, because it still has the Pawn on last rank.


💡📝H. G. Muller wrote on Sun, Jul 19, 2020 01:50 PM EDT:

OK, that is interesting, because at the moment the Diagram also has a limitation that it cannot handle more than a single locust victim or unloaded pieces. That is a limitation I was hoping to remove in the future, though. (The Lion Dog of the large Shogi variants can make up to two locust captures, in addition to a normal one.)

Just an idea: wouldn't it be possible to have a move generator generating the move strings for all pseudo-legal moves in the Pre-Move code, and have it do a string compare for each of those with thismove, to see if one matches? If there is one, it can just allow the entire move sequence to be performed without ever having to look at the origin or dest of any of the individual moves. The Post-Move code then would only have to test whether this left the King in check. For this it would basically run the same move generator for the opponent, except that it did not generate strings to compare, but tests whether any of the moves captures the King.


💡📝H. G. Muller wrote on Sun, Jul 19, 2020 05:16 PM EDT in reply to Fergus Duniho from 04:13 PM:

Pairs of coordinates are usually sufficient to describe a move. It would be very useful if there could be an arbitrary number of coordinates, though. It could then also describe moves that need more than two mouse clicks to be entered. The JavaScript could run through the list after every click, to get the sub-set of moves that start with the clicks that have already been made. (With only simple moves, after clicking a piece, this would leave you with the moves of that piece.) It could then highlight the 'next in line' click of each of those, so that the user knows which squares he can click next. If all clicks in a move would have been made, and no other moves start with the same sequence of clicks, the move can be considered entered. If there are still multiple options we can adopt the convention that one has to click the last-clicked square again to terminate the move without waiting for more clicks. E.g. for optional locust captures the second click could be on the locust victim, and the third click could be on the final destination.

Is the issue that to retrieve a position, each time all moves of the entire game have to be replayed? Even if this is the case, it would surprise me if it would take any measurable time at all. Chess engines typically search on the order of a million positions per second, generating all moves in each of these positions. Even if a scripting language would be 100 times slower, and a game on average has 100 moves, it would still only take 10 ms of CPU time to retrieve the game.

But for moves that are already part of the game, there isn't any reason to check their legality at all. This should have been done while they were first entered, and added to the game. Only newly submitted moves would have to be vetted. Older moves can simply be executed as stored. The only problem would be automatic side effects. But typically only very few moves have those. But locust captures or unloads generated from the Betza descriptions would never be automatic; they would always require full specification of the side effect in the input move. So the automatic side effects would remain limited to e.p. captures and castlings, which can be handled in the conventional way.


💡📝H. G. Muller wrote on Mon, Jul 20, 2020 05:12 AM EDT in reply to Fergus Duniho from Sun Jul 19 09:27 PM:

Well, I will definitely start with something simple. But I don't want to paint myself into a corner from the start, so some advance planning of the strategy that will eventually be adopted seems useful.

The problem with using $prev is that it doesn't seem to offer any hope of expanding the capabilities to more than 1 move + 1 explicit side effect, something I would still like to do in the future. It would be possible to specify the side effects before the move, but that mostly subverts the effectivity of the allow command, as to allow both simple moves and combinations suicide + move one would have to allow moves + captures both as first and second move, and then it would not weed out cases where the user typed two normal moves. I could use the explode trick on every move on the off-chance that the user might have entered a move with a side effect, but the store and restore this requires to not mess up the game state must also be an order of magnitude more expensive than just testing pseudo-legality of a given move.

When I would specify allow moves 1 captures 1 promotions 2 freedrops 2 suicides 2 suicides 3 , I could test whether the input line did specify side effects by something like if != dest null and origin: . For simple moves moved and origin are reliable, and I could run the move generator only for the moved piece. Whether the move is compared in coordinate form or as text string really should not matter much. For composit moves I would either have to recover the moving piece through the explode trick, (because I don't know how many suicides followed it, so I cannot rely on prevorigin either), or generate moves for all pieces to see which one matches the thismove string.

It would have been very helpful, efficiency wise, if it could be tested whether the Pre/Post-Move code is run for a new input move, or just for a move that was already accepted as part of a game, and is now played to set up the current position. Is there a variable that holds the current game length? I suppose it would be possible to update a global counter in the Pre-Move section (initialized to 0 in the Pre-Game section) to keep track of the move number. If the move is not the last move in the game, the Pre/Post-Move code could be made to suppress any unnecessary (pseudo-)legality testing. In particular, composit moves would not have to be tested, as they would be guaranteed to not have any implied side effects (the very reason for them being composite being that they explicitly specify all their side effects).

[Edit] is this a matter of comparing movenum with mln ?


💡📝H. G. Muller wrote on Tue, Jul 21, 2020 06:19 AM EDT in reply to Fergus Duniho from Mon Jul 20 10:46 PM:

I'm thinking of providing more information, but it requires an array, and I'm still looking into how I might handle that.

It would already be very helpful if the 'origin' and 'moved' info was always available for the first move of the sequence. Without that, the following code seems to do what is required. (I did not want to use the Do Not Include checkbox, as the store / restore is only needed on the latest move of the game, while on all other moves it would come in handy if it is automatically performed.)

The underlying assumption is that implied e.p. captures and moves that generate e.p. rights ('double pushes') will never have other (explicitly specified) side effects, and will thus be entered as simple moves. (For castlings XBetza already guarantees that, but it is in theory possible to specify rights-generating moves that would also make a locust capture. It is hard to imagine any Chess variant would ever have that, though.)

Pre-Move:

if != mln $maxmln:
  store;
endif;

Post-Move:

if == mln $maxmln:
  // last move must be tested for legality
  store resultpos;
  restore;
  if == dest null or not origin:        // move is composit
    set mvs explode chr 59 thismove;    // split it
    eval join "MOVE: " trim elem 0 mvs; // get origin and moved of first part
    restore;
  endif;
  set legal false;
  set task 0;                  // specifies what subroutine genmoves should do with the generated moves
  gosub genmoves moved origin; // compare all moves of the piece to thismove
  if not legal:
    die "Illegal move";
  endif;
  restore resultpos;
  if unload:
      drop unload dropsqr;   // relocates another piece (also used for castling)
  endif;
  if locustsqr:
    capture locustsqr;       // removes another piece (also used for castling and e.p.)
  endif;
elseif != dest null and origin:
  // setting up game: guaranteed to be legal, apply implied side effects only
  if match dest epsqrs and ep:
    if or checkaleap origin dest 1 1  // code specifically generated to recognize
          checkaleap origin dest -1 1 // e.p.-capable leaps to empty squares
       and == moved P
       and not capture:
      capture #ep                     // and remove the victim
    endif;
  elseif match dest wcastle:
    if == moved K:  // code specifically generated to
      ...           // identify castling partner and move it
    endif;
  endif;
  set ep false;
  set epsqrs;   // empty array (?)
  if checkaleap origin dest 0 2   // code specifically generated to recognize
     and == moved P:              // e.p.-rights-creating leaps
    set ep dest;
    push epsqrs where origin 0 1; // add all e.p. squares
  endif;
  setflag dest;
endif;

The routine 'genmoves' would generate all moves of a given piece in a given location, in the context of the pre-move board position. In the process it would also build a list of side effects: squares that have to be cleared, or where the captured piece has to be dropped. For 'task 0', used here, it would build a string through

join moved chr 32 origin chr 45 dest chr 59

plus the required suicides and freedrops describing the side effects (e.g. ... chr 32 chr 64 chr 45 sideeffect), for comparison with thismove. On a match it would set legal true, and actually perform the suicide.


💡📝H. G. Muller wrote on Tue, Jul 21, 2020 08:55 AM EDT:

If the info on the first move on the sequence was always available, e.g. as firstmoves, firstorigin etc., and we would use the checkbox to suppress autoexecution of the move, it might be acceptably efficient to do the legality checking on all moves. That would certainly simplify the code a lot:

Post-Move:

set legal false;
set task 0; // specifies what subroutine genmoves should do with the generated moves
gosub genmoves firstmoved firstorigin; // compare all moves of the piece to thismove
if not legal:
  die "Illegal move";
endif;
eval join "MOVE: " thismove; // make the move and its specified side effects
if unload:
  drop unload dropsqr;       // dropsquare and unload set by genmove for castlings
endif;
if locustsqr:
  capture locustsqr;         // locustsqr set by genmoves for castlings and e.p. captures
endif;
setflag firstdest;           // moved piece is flagged as non-virgin

The need to store / restore has disappeared. The subroutine genmoves compares the moves of the moved piece in the pre-move position stringwise with thismove, and detects the cases where we are dealing with castling and regular e.p. capture. The implied side effects of these are then flagged by setting unload, dropsqr and locustsqr (which otherwise remain at false). Non-implied side effects are explicitly specified by the move, and thus already executed when we make thismove. So only these implied side effects have to be made afterwards (if the move proved pseudo-legal).

The subroutine genmoves would handle testing and setting of the e.p. info by itself; global variables ep and epsqrs would be involved in that.

Because the code is color-independent, it would probably be best to put it in a subroutine, and have both Post-Move sections just call that subroutine. Since it is also not dependent on the specifics of the variant, it could even be put in an include file. If the routine genmoves would be 'table-driven', it would also be variant-independent, and could also go into that include file. The data to drive it could then be supplied by variant-specific functions for each piece that would return an array describing the moves they could make. It would be the definitions of these funcions that would be generated by the Play-Test Applet, and would have to be copy-pasted to the corresponding preset. (To the Pre-Game section?)

I suppose the info about the first move of the sequence could be extracted 'by hand', by repeated explode, fist on a semicolon, then on a space to separate piece ID from move (already providing moved), and finally the move part on hyphen to get origin and dest.


Apothecary Chess-Classic. Large board variant obtained through tinkering with known games.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Tue, Jul 21, 2020 10:05 AM EDT:

Is that minus sign in Pawn-Range intended, or is it a typo for an underscore?


Play-test applet for chess variants. Applet you can play your own variant against.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Tue, Jul 21, 2020 01:32 PM EDT in reply to Fergus Duniho from 11:53 AM:

The problem is that it is not always easy to know what exactly one should test. XBetza could allow moves that go through meandering paths to strange destinations, and deducing the path from just the origin and destination square could be problematic. Even with a comparatively simple piece like the Sissa, a move from e4 to g4 could have gone through e5-e6-f5, f5-g6-g5, e3-e2-f3 or f3-g2-g3. With doubly-bent moves (e.g. a Tenjiku Shogi 'area move') it is even worse. The simplest way is often to generate all moves according to the XBetza prescription, and picking out the one that hits the desired destination.

Note that I don't want to generate all moves. Just all moves of one piece. But for that I have to know which piece, and where it starts.

I agree that for simple slides and leaps this might be overkill, and testing those with checkaleap or checkaride (or even checkleap or checkride, if you know the piece to be fully symmetric) would be far simpler. You cannot see from the input move whether that is possible though; the mentioned Sissa move from e4 to g4 looks like a Rook move, but in fact has nothing to do with it. But during interpretation of the XBetza description it can be seen which moves consist of only a single leg. So perhaps the strategy should be to generate direct checks for those (which then for many pieces would handle them completely), and supplement that with a routine to generate all multi-leg moves of a given piece, and only run that to compare these moves to thismove when the simple tests have failed.

But this is basically optimalization. The point is that a routine to generate all moves (even not just of one piece, but of all pieces) is needed anyway, for the purpose of setlegal. Once that function exists, it is trivial codewise (albeit a bit inefficient timewise) to use it to compare the moves with the input move. The best strategy for getting something that works seems to start with the codewise simple method. Once that works it can be optimized by generating dedicated code for some of its tasks.


💡📝H. G. Muller wrote on Wed, Jul 22, 2020 01:57 AM EDT:

Would it be an idea to tick the checkbox and take charge of the parsing of the move ourselves? E.g. with code like:

  set mvs explode chr 59 thismove;
  set parts explode ws trim elem 0 mvs;
  set i count mvs;
  if > i 2:
    die "move must be piece ID plus board step";
  endif;
  set sqrs explode chr 45 trim elem dec var i parts;
  if != 2 count sqrs:
    die "board step does not mention two squares";
  endif;
  set myorigin elem 0 sqrs;
  set mydest elem 1 sqrs
  if not onboard myorigin or not onboard mydest:
    die "the board isn't that large";
  endif;
  set mymoved space myorigin;
  if != mymoved elem 0 parts and == 1 i:
    die join "there is no " elem 0 parts " at " myorigin;
  endif;


This seems more efficient than storing and restoring the game state all the time to undo what the system does automatically. And it could also be extended to understand more elaborate move formats, like origin-ep-dest or even origin-ep1-ep2-dest for moves that make a locust captures on ep / ep1 / ep2. Of course we would have to make the move ourselves, at some point, (after the legality testing) by something like

  empty myorigin;
  capture mydest;
  add mymoved mydest;


💡📝H. G. Muller wrote on Wed, Jul 22, 2020 05:30 AM EDT:

A general question: do the logical operators and and or also accept numbers as operands, and do they consider 0 false and any other value true, like in C? Or do I explicitly have to convert them to logical values by comparing the numbers with 0?

And am I correct in assuming there is a distinction between using inc (or empty) as an operator in an expression or as an independent command, where only in the latter case it alters its argument? (I.e. is let a inc var a; the same as inc a; ?)


💡📝H. G. Muller wrote on Wed, Jul 22, 2020 05:34 PM EDT in reply to Fergus Duniho from 09:41 AM:

OK, thanks. I never used PHP, so it takes a bit of getting used to. The 'let' must have been a sub-conscious confusion with BASIC. What also confuses me is that the # / var do not seem to be needed on origin, dest and such. Is that because these are really subroutines rather than variables?

The need to handle the implied side effects is a bit of a pain. XBetza could potentially define e.p. capture through Gryphon or Sissa moves. Also, to test the pseudo-legality of the latest move of the game, the preceding move would have to correctly set the e.p. rights. The best strategy seems to include a 'stripped' move generator in the GAME code, which generates only moves with implied side effects (i.e. e.p. capture, moves that create e.p. rights, and castlings). This would then be run for every simple move (the mentioned moves are never composit). This would be rather cheap, as most pieces don't have any such moves at all, so it would not generate anything when these move. In most CVs it would only generate something when a Pawn or a King moves, and it would then only generate the double-push if it was a 2nd-rank Pawn,  the e.p. capture if an e.p. square was created on the previous move, and in range, and sometimes one or two castlings. The few moves it generates could then be compared to origin and dest, and if one of them matches, all the side effects of it indicated by the move generator (i.e. e.p.-victim removal, Rook movement, or setting of the e.p. rights) would then be applied to the board.

For the latest move a complete move generator would generate all moves of the moved piece, and compare those to the input move. This is not optimally efficient, but it is easy and requires very little code that wasn't needed already for other purposes. And it is still very much cheaper than generating all legal moves in the final position for the purpose of setlegal: it has to be done only for a single piece, and the full legality has to be tested only for the move that matches the input. While setlegal requires the pseudo-legal moves of all pieces, and has to test each and everyone of those for legality. So there really wouldn't be any significant gain in optimizing it further, just a far larger code complexity.


💡📝H. G. Muller wrote on Thu, Jul 23, 2020 03:56 AM EDT:

Just to be sure: lines in subroutines are only 'pre-processed' when they are executed, but functions when they are defined? So in subroutines var and # would be equivalent?

I slowly start to converge on a design. The idea is that the Post-Move code would always only contain only the line gosub HandleMove false; (for white) or gosub HandleMove true; (for black). Similarly, the Post-Game code would only contain gosub GameEnd true/false; . The routines would be universally applicable code, which could go into the Pre-Game section, or into a file that would be included from there.

The rules would then be described in the Pre-Game section by a large initialized array 'legdefs' of integer numbers, encoding all the moves, functions for each piece type returning where the move data for that piece type starts in legdefs. Plus statements to set a number of parameters, like what the royal type for each player is, whether stalemate is a win or draw, what King destinations imply castling, where the castling partners are located, how large the promotion zone is, what you can promote to on various ranks, which pieces van promote and stuff like that. Defaults for those parameters could be set in the included file, but the CV-specific code could overrule those settings after the include. It is this Pre-Game code that would be generated by the Play-Test Applet.

A rough draft of the code for such a design is this:

// the following arrays and functions are variant-specific, and would be defined in Pre-Game:

set legdefs (....); // a (very large) array of numbers, describing the moves of all pieces
                    // each move is a sequence of 'legs' (leaps or slides in one direction)
                    // each leg is described by 4 numbers in legdef:
                    // range, sideway step, forward step and 'mode'.
                    // the mode packs bit flags describing what must be at the end of the leg
                    // a move with 0 legs is used to indicates the list for that piece ends

def P cond #0 223 45;  // functions map piece types on their move definition in legdefs
def p cond #0 235 70;  // each piece has two move definitions: e.p.&castling-only, or all their moves
def K ...

set many wroyal K broyal k;
...

// the following code is generic, and can be handled as a Pre-Game include

sub GotMove orisqr destsqr:
  // process the move specified by the params and the globals like locustsqr
  if == 0 #task:      // apply side effects of a matching move
    verify == #orisqr origin and == #destsqr dest:
    if #locustsqr:
      empty locustsqr;
    endif;
    if #dropsqr:
      add #unload #dropsqr;
    set hit true;    // abort further generation

  elseif == 1 #task: // test input move for pseudo-legality
    verify == #orisqr origin and == #destsqr dest:
    if not #implied: // explicitly specified side effects must also match
      verify == #locustsqr #suicide;
      verify == #dropsqr #freedrop;
      verify == #unload #dropped or not #dropsqr;
    else:            // no side effects must be specified when they are implied
      verify not #suicide and not #freedrop;
    endif;
    set hit true;    // we found a matching pseudo-legal move

  elseif == 2 #task: // accumulate all pseudo-legal moves
    setlegal #orisqr #destsqr;

  elseif == 3 #task: // test whether move captures king (for check test)
    if == #royal space #destsqr:
      set hit true;
    elseif #locustsqr:
      set hit == #royal space #locustsqr;
    endif;

  elseif == 4 #task: // find one legal move (for mate test)
    my victim locustvictim;
    set victim space #destsqr; // save old values
    // make the move
    if #locustsqr:
      set locustvictim space locustsqr;
    endif;
    if #dropsqr:
      add #unload #dropsqr;
    endif;
    move #orisqr #destsqr;
    // test whether in check
    gosub InCheck #side;
    // unmake the move
    move #destsqr #orisqr;
    if #dropsqr:
      empty dropsqr;
    endif;
    if #locustsqr:
      add #locustvictim #locustsqr;
    endif;
    set hit not #hit; // continue when in check, stop when not

  endif;
endsub;

sub NextLeg togo legindex startsqr cursqr iso:
  // this routine is the heart of the move generator
  // it generates the destinations of one leg,
  // and then calls itsef recursively for the remaining legs
  // 'togo' tells how much legs still have to be done; when 0 we have a complete move
  // 'legindex' tells where the leg descriptions start in the 'legdefs' array
  // 'startsqr' is where the piece that must make the move starts
  // 'cursqr' is where any previous legs brought us
  // 'iso' is the number of leaps taken in an earlier riding leg
  if #togo: // move not complete yet; attempt next leg
    my range dx dy mode to;
    // retrieve leg description (next 4 elements in 'legdefs')
    set range elem #legindex #legdefs;
    set dx elem + 1 #legindex #legdefs;
    set dy elem + 2 #legindex #legdefs;
    set mode elem + 3 #legindex #legdefs;
    if & #mode i_FLAG:                    // initial move only
      verify not ?startsqr;               // suppres it for non-virgin piece
    endif;
    // simple example, handling only (divergent) leaps
    if == 1 #range:                       // leg is leap
      set to where #cursqr #dx #dy;       // calculate destination
      set victim space #to;               // look what is there
      verify != void #victim:             // abort if off board
      if == @ #victim:                    // empty target
        if match #to #epsqrs and
           & mode e_FLAG:                 // move is valid e.p. capture
          set locustsqr #ep;              // flag that it will capture last mover
          set implied true;               // this is an implied side effect
        else:
          verify & #mode m_FLAG;          // m_FLAG etc. are in fact hard-coded constants like 1, 2, 4, 8...
        endif;
      elseif != #side islower #victim:    // foe
        verify & #mode c_FLAG;
      else:                               // must be friend
        verify & #mode d_FLAG;
        set unload #victim;               // remember what we 'captured'.
      endif;
      gosub NextLeg dec #togo + 4 #legindex #startsqr #to #iso; // do nex leg
    else:                                 // leg is slide
      ...
    endif;
  else: // move finished successfully; process it
    GotMove #startsqr #cursqr;
  endif;
endsub;

sub GenMoves piece sqr all:           // generates moves for 'piece' on 'sqr' in current position
                                      // 'all' specifies whether we get only moves with side effects
  my index legcount;
  set side islower #piece;            // remember which side we are generating for
  set index fn #piece #all;           // function returns start of piece description in legdefs table
  do:
    set legcount elem #index legdefs; // the first element specifies the number of legs
    verify #legcount;                 // a 0 sentinel ends the list of moves
    inc #index;                       // 'reads away' the leg count
    set many locustsqr 0 dropsqr 0;   // default is no locust capture or unload
    set implied 0;                    // generated e.p. or castlings set this
    gosub NextLeg #legcount #index #sqr #sqr 0;
    set index + #index * 4 #legcount; // skip to the next set of legs (= move)
  loop until hit;
endsub;

sub GenAll black:
  if #black:
    def friends onlylower;
  else:
    def friends onlyupper;
  endif;
  for (from piece) fn friends;
    gosub GenMoves #piece #from 1;
  next;
endsub;
 
sub HandleMove player:
  gosub ParseMove thismove; // this extracts origin, dest, moved, suicide, freedrop, dropped
  set hit false;
  if == mln $maxmln:
    set task 1; // request legality test
    gosub GenMoves moved origin 1; // match all moves
    if not #hit:
      die "a " moved " cannot move that way!";
    endif;
  endif;
  set task 0; // request execution of implied side effects
  gosub GenMoves moved origin 0;   // only tries e.p. and castling
  eval join "MOVE: " thismove;     // make the move
  setflag dest;
endsub;

sub InCheck player
  set task 3; // request king-capture test
  set hit false;
  set royal cond #player #broyal #wroyal;
  gosub GenAll not #player;
endsub;

sub GameEnd player:
  gosub InCheck player;
  if #hit:
    die "that move would put you in check!"
  endif;
  set task 4;  // request one legal move
  gosub GenAll not player;
  if not #hit: // could not find one
    gosub InCheck not player;
    if #hit:   // checkmate!
      won;
    elseif #staledraw: // stalemate
      draw;
    else:
      won;
    endif;
  endif;
  ... // draw stuff
endsub;

 


💡📝H. G. Muller wrote on Thu, Jul 23, 2020 11:43 AM EDT:

Below is how the GAME code generated for the Pre-Game would have to look for orthodox Chess. This assumes 'smart' generation, which realizes that most pieces are symmetric, so that white and black can use the same table entries for those, and that the Bishop is just the final part of the Queen. Most likely it would be too dumb to see the latter, and then a separate Bishop section would be added. If the pieces were asymmetric, or it was not smart enough to realize they are symmetric, all pieces sections would have to appear in duplicat: one for white, one for black.

include betza.txt
set legdefs
 1  1  0  1  3 // King (0)
 1  1  0 -1  3 // 3 = m_FLAG + c_FLAG
 1  1  1  0  3
 1  1 -1  0  3
 1  1  1  1  3
 1  1  1 -1  3
 1  1 -1  1  3
 1  1 -1 -1  3
 2  9  1  0  8 // castling (40)
    1  2  0  3
 2  9 -1  0  8
    1 -2  0  3
 0
 1  9  0  1  3 // Queen (59)
 1  9  0 -1  3
 1  9  1  0  3
 1  9 -1  0  3
 1  9  1  1  3 // Bishop (79)
 1  9  1 -1  3
 1  9 -1  1  3
 1  9 -1 -1  3
 0
 1  9  0  1  3 // Rook (100)
 1  9  0 -1  3
 1  9  1  0  3
 1  9 -1  0  3
 0
 1  1  2  1  3 // Knight (121)
 1  1  2 -1  3
 1  1  1  2  3
 1  1 -1  2  3
 1  1 -2  1  3
 1  1 -2 -1  3
 1  1  1 -2  3
 1  1 -1 -2  3
 0
 1  1  0  1  1 // white Pawn (162), 1 = m_FLAG
 1  1  1  1  2 // 2 = c_FLAG
 1  1 -1  1  2
 1  1  1  1  4 // e.p. capture (177), 4 = e_FLAG
 1  1 -1  1  4
 2  1  0  1 577 // double push, 577 = m_FLAG + i_FLAG + rights creation
    1  0  1  1
 0
 1  1  0 -1  1 // black Pawn (197)
 1  1  1 -1  2
 1  1 -1 -1  2
 1  1  1 -1  4 // e.p. capture (212)
 1  1 -1 -1  4
 2  1  0 -1 577
    1  0 -1  1
 0;

def K cond #0   0 40;
def k cond #0   0 40;
def Q cond #0  59 58; // 58 = empty move set
def q cond #0  59 58;
def R cond #0 100 58;
def r cond #0 100 58;
def B cond #0  79 58;
def b cond #0  79 58;
def N cond #0 121 58;
def n cond #0 121 58;
def P cond #0 162 177;
def p cond #0 197 212;

set pzs 1;             // promo zone depth
set rooks a1 a8 h1 h8; // castling partners
set wchoice (Q R B N);
set bchoice (q r b n);
set stalemate 1;
set wroyal K;
set broyal k;

 


💡📝H. G. Muller wrote on Thu, Jul 23, 2020 01:28 PM EDT:

Well, this is definitely a powerful method, and allows handling of boards of any topology. But I don't see how it would simplify things in this case. The Interactive Diagram can only handle grid boards consisting of squares. Perhaps with some straightforward wrapping rules (periodic boundary conditions, such as cylinder or torus). Betza notation would be meaningless in boards with irregular topologies.

The code example doesn't alllow for wrapping yet. I guess that when the where operator produces an off-board result, it should really test mode to see whether the move is supposed to wrap (o_FLAG). If it does I guess I would be in for some cumbersome arithmetic on separate file and rank of the startsqr. That would also mean that I cannot use ray for the riding legs, but would somehow have to extend the ray after wrapping.


💡📝H. G. Muller wrote on Thu, Jul 23, 2020 01:59 PM EDT:

It is true that XBetza uses directions and relative directions a lot. But the Diagram script already translates that to absolute grid vectors in a compilation step. The legdefs array is almost exactly what the Diagram uses as internal representation (except that dx, dy, range and mode there each have their own array, but that is a minor detail). So the only thing it has to do when someone would hit the would-be button 'Show GAME code' would be to dump those tables for the pieces that were chosen to participate in the desired format, and remember where the data for each piece started. It can be easily checked during the Betza-to-table compilation whether a piece is totally symmetric. (Not done yet; the Diagram only makes tables for white pieces during the compilation, and when it later generates moves for black pieces, it just flips the sign of all step vectors it retrieves from the table. But it seems faster to tabulate the black pieces separately, flipping their steps already in the table, if they were asymmetric.)


💡📝H. G. Muller wrote on Fri, Jul 24, 2020 02:32 AM EDT:

Umm, there seems to be a mismatch between the naming of the scalable (SVG) pieces used in the Applet, and the fixed-size 50x50 (GIF) bitmaps in the alfaerie directory. E.g. the wazirknight does not show up because for the alfaerie bitmaps it is actually called knightwazir. The Archbishop / Chancellor / Amazon are my own fault; the SVG renderer used by the Applet creates such compound images 'on the fly', by referring to them as knight--bishop, knight--rook and knight--queen, while in the 50x50 alfaerie set they are of course called cardinal, chancellor and amazon. I should have had the Applet script replace those names when it dumps the design as a diagram using the standard image set.

Thank you for reporting this; it will certainly be fixed one way or the other. For now you can work around it by editing the Diagram description to replace the faulty filenames of the missing pieces by the correct ones. An alternative would be to keep the names, but change the graphicsDir from /graphics.dir/alfaerie/ to http://winboard.nl/my-cgi/fen2.cgi?s=50&p= and the graphicsType to an empty string (just graphicsType= ), to get the same anti-aliased images as the Applet uses (but 50x50). But then you would be using off-site images, and that is really against CVP policy.

For the editors:

In connection with this, it is perhaps a good time to bring up the following issue: wouldn't it be a good idea to improve the availability and/or quality of piece graphics on CVP? The rather ragged-looking alfaerie 50x50 GIF bitmaps in /graphics.dir/alfaerie/ are still the site's standard piece set. Isn't it time to replace those with anti-aliased PNG images, or at the very least provide such a set next to it (e.g. in /graphics.dir/alfaeriePGN/)? I suppose it would be easy to copy the same index page on alfaerie to that other directory, to showcase the pieces.

I would also be happy if there could be a 35x35 alfaerie image set; for the Applet I am currently using an off-site SVG renderer. Of course I could upload a set of 35x35 images myself, even defvote a member-submitted article to them, but then they would be hidden in /membergraphics/MSalfaerie-33 (say), and no other person but me would ever find them there. To get good use of the graphics we have, they really should be provided as options in places where people could decide to use them.


💡📝H. G. Muller wrote on Fri, Jul 24, 2020 01:31 PM EDT in reply to Carlos Cetina from 01:11 PM:

It should now be fixed for new Diagrams generated by the Applet. But it might still be easier to just edit the image names in the Diagram you already made than redoing it from scratch. While fixing the issue I was baffled by the fact that the Applet had stopped working completely; its board mysteriously disappeared. After a lot of debugging it turned out that it was upset that another Diagram had appeared on the same page, in the Comments. The Applet needed to change some settings after initialization, but the way I had programmed that was not resistent to the betza.js file being read a second time, undoing some of the changes. I guess it was a very bad idea to have some of the standard initialization code execute unconditionally when the script gets loaded, in a script that could be loaded multiple times. Eventually I modified the script such that custom post-initialization code can be executed after all Diagrams on the page have done their initialization, rather than just the first one.

I also made the Applet close the ad side bars when the board has more than 10 files. This should prevent the compression we see in the screenshot you posted.

BTW, I noticed that you are using piece IDs of more than one letter. The Diagram was not really designed for that. In particular, it confuses its detection of which promotions are allowed. Because you use both K and DK, and put DK amongst the promotion choices, it now thinks K is also an allowed choice, because there is a K in DK. I am not sure how this can be cured without breaking already existing diagrams.

@Greg:

OTOH, having one or two ugly pieces among good-looking ones would provide a really good incentive for creating the missing SVG. :-) The variants you authored do not seem to feature that many pieces for which we have no SVG yet.


💡📝H. G. Muller wrote on Fri, Jul 24, 2020 02:29 PM EDT in reply to Greg Strong from 01:50 PM:

You already put those on this website, at /graphics.dir/svg/ . I haven't made any new ones since then, as it seemed not much was happening with them, and almost everything that I imagined I would ever need was already done.

There is an identical set on the winboard.nl server, where I have the SVG renderer as CGI program. I use them in the Diagram of the Applet through that renderer, but the Applet first looks in the /graphics.dir/svg/ directory on CVP to see what pieces exist. (Browsers do not allow peeking at a website other than where the main HTML page comes from.) The piece table of the Applet contains everything that is there, plus some compounds that the renderer creates on the fly.

There are no SVG for these compounds (or for rotated pieces, or red / green pieces), but since the renderer can supply all those as PGN it should not be too difficult to download those one by one and put them in the PGN sets.


Diagram Editor with scalable graphics. An easy-to-use tool for drawing boards and pieces of any size and color.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Fri, Jul 24, 2020 03:43 PM EDT:

Let me move this discussion to a more applicable thread. Are you changing the color after you rendered it as PGN, through a flood fill? That would indeed not work, because the anti-aliasing would produce all kind of average shades where the color touches the outline, some very close to white but not exactly so, and the flood fill would not capture those. You would have to change the color when it is still SVG.

The way I do it in the renderer is that I load the SVG in a memory buffer, search it for #FFFFF (or whatever I know the original color to be), and substitute that for the desired color, (it is a text file!) before I pass it to the routine that renders it as a bitmap. And then use a routine to save bitmaps as PNG.

I suppose it should be very little work to change the renderer (which now parses CGI query strings handed to it as 'environment' variables) to take its requests from the normal (argc, argv) command-line arguments (or even hard-code what color / size / orientation we want), and then run it in a shell script to render every SVG file. But I guess we should be a bit selective in what we render; we probably only want rotated versions of the orthodox pieces. And I am not sure whether we would want to have complete alfaerie sets in red or green.


💡📝H. G. Muller wrote on Fri, Jul 24, 2020 04:22 PM EDT:

OK, even easier. I did use the on-line renderer. I just transformed the directory listing of http://winboard.nl/graphics.dir/svg/alfaerie, obtained through wget, into a shell script that used wget to download the piece image directly from the renderer, and save them on a file bpiecename.png.

A tar ball with all the black 50x50 PNGs is now at http://hgm.nubati.net/black50.tar.gz .

Now that I have that script, it is even more trivial to turn it into a script for doing white, or red, or 35x35, or upside-down. What shade of red would we want?

[Edit] Now also a complete 35x35 set (white and 'black') at http://hgm.nubati.net/alfaerie35.tar.gz .


💡📝H. G. Muller wrote on Fri, Jul 24, 2020 04:51 PM EDT:

Strange, I do see some imperfections in the black pieces with the renderer as well. I don't understand how that can happen; the white seems to cover anything. Could there be color indicators in the SVG that I somehow fail to substitute? Perhaps the Rooks are just sloppily drawn, so that the background leaks through. This is much more visible on a dark piece: 0 to 10% is a huge contrast, 100% to 90% barely visible.


💡📝H. G. Muller wrote on Sat, Jul 25, 2020 03:08 AM EDT:

OK, I rendered all pieces with dark color on light backround as 100x100, so that we can easily judge which have imperfections that should first be cured. If you fix those, I will put the fixed SVG on the winboard.nl server so that the renderer uses those, and then query the renderer to make the complete sets we want.

We should also think about which forward-backward compounds we want; the renderer can also compose these on the fly.


💡📝H. G. Muller wrote on Sat, Jul 25, 2020 03:33 AM EDT:

Well, I posted it just minutes ago, and it is 9 am here, and I did actually have a sound night of sleep. I will move your new pieces to winboard.nl now.

[Edit] OK, I unpacked your zip file in a directory 'newalfa' on winboard.nl, which means the renderer will now use them if you add the extra argument t=newalfa in the query string. It doesn't entirely work as expected, though. For one, some of the pieces stay white. (I used exactly the same FEN as for the old pieces.) Which probably means the SVG has given them a shade of white that is slightly different from what it was before, and for which the renderer scans the file to substitute it. The rendering also stops at some point. (Probably a missing file, haven't figured that out yet.)

[Edit] OK, FEN rendering stops at the first missing SVG. I copied a few missing ones from the old set (lion, cannon, paovao, nightrider), but very many are still missing.


GAME code table-driven move generator[Subject Thread] [Add Response]
H. G. Muller wrote on Sat, Jul 25, 2020 08:42 AM EDT:

It seemed best to start an independent comment thread for this. The goal of this project is to develop GAME code that can be almost universally used for rule enforcement in Game Courier presets. The rules that will be enforced (piece moves, possible promotions, initial piece shuffling) will be encoded in some tables, which are then initialized in the Pre-Game section. These CV-specific tables can then be hand-coded, but also generated automatically through the Play-Test Applet, and copy-pasted in the Pre-Game section from there.

To not get ahead of ourselves, the project will be divided into several phases, where each phase would correspond to a functional preset, which will progressively allow less and less violation of the game rules. Phase 0 will test the basic method of handling the moves. To remain in full control over vetting and performing the moves, the preset will be created with the checkbox "do not include moves in GAME code" ticked. This means the preset would not do anything at all with entered moves, unless the Post-Game code tells it what to do.

The minimum requirement is thus to let the Post-Game code order execution of the entered move(s). This will already be done the way the finished project would do it: all code for handling a move will go into a subroutine HandleMove, and the only code in the Post-Move sections will be calling this subroutine:

gosub HandleMove false;

and

gosub HandleMove true;

where the Boolean parameter indicates whether the black player is making the move. The Pre-Game code for phase 0 will define the subroutine as:

setsystem maxmove 4;
ban commands;
sub HandleMove player:
  eval join "MOVE: " thismove;
endsub;

This will order Game Courier to do what it would have done automatically if we hadn't ticked the checkbox: perform the move exactly as entered, "no questions asked". For now the input can consist of any combination of up to 4 moves, promotions, drops, etc.

In phase 1 the input move will be tested for syntactical correctness, before we allow its execution.


Diagram Editor with scalable graphics. An easy-to-use tool for drawing boards and pieces of any size and color.[All Comments] [Add Comment or Rating]
💡📝H. G. Muller wrote on Sat, Jul 25, 2020 10:53 AM EDT:

Indeed. The others have color #f9f9f9, and the renderer is configured (through the http://winboard.nl/graphics.dir/svg/newalfa/defaults.ini file) to replace that by the color requested in the query string. Since not all pieces are shown I cannot exclude that there aren't any others.

[Edit] Our messages crossed. It was what the others had: some had already been done (those we have to repair now), and they used this color. I just copied that for the pieces I made.

How it converts them is determined by the deaults.ini file in their directory. This specifies the color to replacem the white and black default filling colors, and the default light and dark square shades. Plus some parameters for making compounds.


💡📝H. G. Muller wrote on Sat, Jul 25, 2020 11:06 AM EDT:
I think it is best to stick to the original alfaerie naming; I just accidentally misnamed the knightwazir and knightferz. The renderer just uses the names of the SVGs. And the Applet shows the SVG names as they are in /graphics.dir/svg/alfaerie.

The defaults.ini file for alfaerie contains:

f9f9f9
f9f9f9
a0a0ff
e0c080
A89060
compound 64 52 0 3 40
B~ = knight,N-B
R~ = knight+rook,N-R
Q~ = knight+queen,N-Q
C~ = gnu,C-Q
S = silvergeneral
G = goldgeneral
P^ = lance
N~ = horse

100 comments displayed

EarliestEarlier Reverse Order LaterLatest

Permalink to the exact comments currently displayed.