Check out Janggi (Korean Chess), our featured variant for December, 2024.

Enter Your Reply

The Comment You're Replying To
H. G. Muller wrote on Mon, Mar 13, 2023 09:31 AM UTC in reply to Fergus Duniho from Sun Mar 12 08:22 PM:

Storing the game state as the sequence of moves from the initial position is a good method, and for most of the game more compact than remembering the current board position. Especially for large games. And a large part of the move history is actually part of the game state, if there is an N-fold repetition rule. Ordinary move notation is not reversible, so taking back moves directly would require storing extra information (such as what was captured), and replaying the game from the start solves that problem. (But in shuffle games you would also have to remember the start position, or at least the random seed used for generating it.)

The question was not whether it was needed/desirable to replay the moves, though, but whether it was necessary to test the (pseudo-)legality during this replay. And there the answer is "no, except for the latest move". Since Game Courier is such that you can only add one move at the time, all earlier moves must have been the latest move at the time they were added, and when they were legal then, they will be legal in the replay as well. And otherwise they would have been refused, and never added to the game.

So for all but the last move there is no need to test pseudo-legality, and moves that are 'self-explanatory' can just be performed as specified. The only caveat is the handling of moves that have implied side effects. These should be recognized at all time, and when they appear the implied side effect should be performed in addition to what the move specifies explicitly. Common cases of implied side effects are disappearence of the enemy Pawn on e.p. capture, and moving of the Rook in castling. Depending on the prescribed move notation there could be other cases, such as the captures in Ultima. In principle all Ultima moves can be described by the origin and destination of the moving piece.

In the GAME code generated by the Play-Test Applet I treated this by having two sets of moves for each piece: one consiting of all the moves, and one only of the moves with implied side effects. For most pieces the latter set would be empty. Only for the latest move the full move set is used, to check if the newly entered move is amongst those. For all other moves it is only tested whtherthe move matches one with implied side effects, and if it does the generated move (which is aware of the side effect) is performed rather than the move from the move list (which does not specify any side effect). Moves that do not match any of the moves with implied side effects are taken at face value.


Edit Form

Comment on the page How to Enforce Rules in Game Courier

Conduct Guidelines
This is a Chess variants website, not a general forum.
Please limit your comments to Chess variants or the operation of this site.
Keep this website a safe space for Chess variant hobbyists of all stripes.
Because we want people to feel comfortable here no matter what their political or religious beliefs might be, we ask you to avoid discussing politics, religion, or other controversial subjects here. No matter how passionately you feel about any of these subjects, just take it someplace else.
Avoid Inflammatory Comments
If you are feeling anger, keep it to yourself until you calm down. Avoid insulting, blaming, or attacking someone you are angry with. Focus criticisms on ideas rather than people, and understand that criticisms of your ideas are not personal attacks and do not justify an inflammatory response.
Quick Markdown Guide

By default, new comments may be entered as Markdown, simple markup syntax designed to be readable and not look like markup. Comments stored as Markdown will be converted to HTML by Parsedown before displaying them. This follows the Github Flavored Markdown Spec with support for Markdown Extra. For a good overview of Markdown in general, check out the Markdown Guide. Here is a quick comparison of some commonly used Markdown with the rendered result:

Top level header: <H1>

Block quote

Second paragraph in block quote

First Paragraph of response. Italics, bold, and bold italics.

Second Paragraph after blank line. Here is some HTML code mixed in with the Markdown, and here is the same <U>HTML code</U> enclosed by backticks.

Secondary Header: <H2>

  • Unordered list item
  • Second unordered list item
  • New unordered list
    • Nested list item

Third Level header <H3>

  1. An ordered list item.
  2. A second ordered list item with the same number.
  3. A third ordered list item.
Here is some preformatted text.
  This line begins with some indentation.
    This begins with even more indentation.
And this line has no indentation.

Alt text for a graphic image

A definition list
A list of terms, each with one or more definitions following it.
An HTML construct using the tags <DL>, <DT> and <DD>.
A term
Its definition after a colon.
A second definition.
A third definition.
Another term following a blank line
The definition of that term.