Check out Chess with Different Armies, our featured variant for July, 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 ]

Single Comment

Play I-Chess on Game Courier. Play this 12x12 large board game with two new peices.[All Comments] [Add Comment or Rating]
H. G. Muller wrote on Sun, Nov 1, 2020 08:33 AM UTC in reply to Greg Strong from Sat Oct 31 10:42 PM:

That ability to review moves locally is really nice! Will this work if added to other presets that are not based on your generated code?

To make this possible you need more than just the move list (which is always on the page), because replacement captures are not reversible. For unprogrammed presets it would be enough to have the starting position, as moves there would always be fully described. If the preset is programmed to automatically execute implied side effects (such as for e.p. capture and castling), the JavaScript would have to mimic that.

The GAME code in the betza.txt include makes use of a feature that Fergus created for this purpose: it can pass an initialized variable to the JavaScript normally embedded in the page. This way it passes the FEN of the initial position plus a comma-separated list of move numbers of e.p. and castling moves. Only when the page defines this variable the JavaScript will create the button bar.

I suppose this could have been designed a bit smarter. Now that I think about it, there isn't really any need to have the GAME code specify the initial position (unless it alters it, like in a shuffle game): the variable that now passes this could also have been initialized in preset-specific JavaScript embedded in the 'rules' section. E.g. <script>var startFEN="....";</script>, generated by the tool together with the link to the common script. That could then be added to any non-programmed preset. Of course the Game Courier standard system could be made to always emit the start FEN of the initial position (taken before it executes the Pre-Move code for the first move).

For a programmed preset it is in general not possible to do this navigation based on the move list, as there is no knowing how the GAME code would have interpreted those move texts. You would either have to embed a list of all game positions in the page, or try to save some space on that by mentioning only the differences between subsequent positions. This could even be done in a reversible way (so that you don't need the start position, but the current one will do): each move could be encoded as a comma-separated list of piece ID + square coordinate, which, depending on the occupant of the mentioned square, would either place or remove the mentioned piece. Differnet turns could be separated by semicolons. Normal non-captures would then require 8 characters, e.g. Pe2,Pe4; , and captures 12, e.g. pd5,Pc4,pc4; . The moves could then be run forward as well as backward, if they firrst mention all deletions, and then all additions.