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 ]

Single Comment

GAME code table-driven move generator[Subject Thread] [Add Response]
🕸Fergus Duniho wrote on Wed, Aug 5, 2020 09:42 AM EDT in reply to H. G. Muller from 03:44 AM:

The pass/skip buttons are now done. When commands are banned in general, the appropriate button will show up with one of these commands is allowed. When commands are not banned, pass will show up on the first move, and skip will show up on any subsequent move for the same turn. My original intention was that pass would be for passing a turn, and skip would be for skipping an optional move within a turn, but even I forgot about that when I programmed Extra Move Chess. Since it would break past games to change it now, what's done is done.

it seems that $answered is the thing I need to break out of the infinite loop

That is half of the answer, though if you're evaluating moves only in the Post-Game sections, then the other part of the answer may be irrelevant.

the GAME code manual lists this just as answered. Is the $ prefix something similar to # or ?, to distinguish variables that live in a different name space?

It is a system variable, meaning it exists in the PHP program at large rather than in the variable stack used for user variables. In GAME Code, the variable prefixes are used to retrieve values, but they are not an inherent part of the variable name. You could retrieve its value with either system answered or with $answered. To set a variable, you would normally enter its name without a prefix. The $ sign is used for system variables, because that is what is used in PHP for variables, and they are really PHP variables.

if there is an array legalmoves passed to the JavaScript, and all moves in it start with the same square, it could just simulate a click on that square by calling movePiece() for that square:

I'll look into that. One application of this would be to make forced moves more visible.

When I do set a #b; where b is an array, it will in general copy the entire array. Except when it is an array of only a single element. Then a will not be an array, but just that element.

I just tested for that and didn't get the behavior you described. I had b as an array of one element, and it copied an array to a, not a single element. I used this code:

push b abbot;
set a #b;
dump;