Check out Janggi (Korean Chess), our featured variant for December, 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

Metamachy. Large game with a variety of regular fairy pieces.[All Comments] [Add Comment or Rating]
🕸Fergus Duniho wrote on Wed, Aug 9, 2017 03:53 PM UTC:

Here's how the function works. It starts with the piece on the space it was already on before moving. It then verifies two things, that the piece hasn't moved, and that it is not attacked. The first checks an attribute of the piece, and the second checks whether an enemy piece could reach the space using its powers of movement. If these are both true, it continues to process the move. The $1 is a variable standing in for the first argument passed to the function. This will be a direction, and it will move in that direction to a new space. It then verifies that this space is not attacked. If this is true, it then proceeds in the direction provided by the second argument, $2. The one thing it verifies here is that the space is empty. If it is, it continues with the rest of the function. The next line sets the piece attribute "never-moved?" to false, which will stop the piece from making a second move of this type. The line after this is commented out. It would have set an attribute that appears to be redundant and unused. With the last line, the add command makes this an official legal move, understood in terms of the piece's powers of movement, but not in terms of whether the move would create an illegal position.

Consider the game of Chess. A King cannot legally move to a space the other King could otherwise move to, because then it would be moving into check. This implies that each King can attack a space it cannot actually legally move to. And this is what attacked means in Zillions-of-Games. It identifies a space that the King would be in check on if it moved there.